Main Content

polyjoin

Convert line or polygon parts from cell arrays to vector form

Syntax

[lat,lon] = polyjoin(latcells,loncells)

Description

[lat,lon] = polyjoin(latcells,loncells) converts polygons from cell array format to column vector format. In cell array format, each element of the cell array is a vector that defines a separate polygon.

Examples

latcells = {[1 2 3]'; 4; [5 6 7 8 NaN 9]'};
loncells = {[9 8 7]'; 6; [5 4 3 2 NaN 1]'};
[lat,lon] = polyjoin(latcells,loncells);
[lat lon]

ans =
     1     9
     2     8
     3     7
   NaN   NaN
     4     6
   NaN   NaN
     5     5
     6     4
     7     3
     8     2
   NaN   NaN
     9     1

Tips

A polygon may consist of an outer contour followed by holes separated with NaNs. In vector format, each vector may contain multiple faces separated by NaNs. There is no structural distinction between outer contours and holes in vector format.

Version History

Introduced before R2006a