This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this 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?