You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: regularizeedges.m
    path of file: ./repos/2D_ALDIC/func_quadtree/refinement
    
    the code of the file until where you have to start completion: function [coordinates,newElements] ...
    = regularizeedges(coordinates,elements,irregular)

%regularizeedges: regularization of irregular quadrilateral mesh  
%            where three different green refinement types come into use
%
%Usage:
%
% [coordinates,elements4] = regularizeedges(coordinates,elements4,irregular)
%

    
function [coordinates,newElements] ...
    = regularizeedges(coordinates,elements,irregular)

%regularizeedges: regularization of irregular quadrilateral mesh  
%            where three different green refinement types come into use
%
%Usage:
%
% [coordinates,elements4] = regularizeedges(coordinates,elements4,irregular)
%
%Comments:
%
%    regularizeedges expects as input a mesh described by the 
%    fields coordinates, elements4, and irregular (virtual quadrilaterals).
%    It regularizes irregular edges by matching appropriate green
%    refinements.
%    The function returns the irregular mesh as regular mesh with output
%    parameters coordinates, elements4.
%
%Remark:
%
%    This program is a supplement to the paper 
%    >> Adaptive Mesh Refinement in 2D - An Efficient Implementation in Matlab <<
%    by S. Funken, and A. Schmidt. The reader should 
%    consult that paper for more information.   
%
%Authors:
% 
%    S. Funken, A. Schmidt  20-08-18


nE= size(elements,1);
nC = size(coordinates,1);
nI = size(irregular,1);
%*** provide geometric data
[~,~,element2edges] ...
    = provideGeometricData(zeros(0,3),[elements;irregular]);
irregular2edges = element2edges(end