This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Convert line or polygon parts from vector form to cell arrays


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


[latcells,loncells] = polysplit(lat,lon) returns the NaN-delimited segments of the vectors lat and lon as N-by-1 cell arrays with one polygon segment per cell. lat and lon must be the same size and have identically-placed NaNs. The polygon segments are column vectors if lat and lon are column vectors, and row vectors otherwise.


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

ans = 
    [3x1 double]    [3x1 double]
    [         4]    [         6]
    [5x1 double]    [5x1 double]

Introduced before R2006a

Was this topic helpful?