Typically, you use the p, e, and t data exported from the PDE Modeler app, or generated by initmesh or refinemesh. For a description of the (p,e,t) matrices, see Mesh Data. kmg2d uses the (probabilistic) initial spatial nodes distribution of. kmg2d is the mesh generator, designed to generate medium-scale meshes.
The mesh generation code consists of two Matlab functions kmg2d and kmg2dref.MESH2D includes variations on the 'classical' Delaunay refinement technique, a new 'Frontal'-Delaunay refinement scheme, a non-linear mesh optimisation. MESH2D is a MATLAB / OCTAVE-based unstructured mesh-generator for two-dimensional polygonal geometries, providing a range of relatively simple, yet effective two-dimensional meshing algorithms.The formatting of a mesh file can be seen using the command “savemesh” and observing the structure of the file. In order to import data from matlab in FreeFem you need to write it to file in a format that FreeFem can read.