polysplit

Convert line or polygon parts from vector form to cell arrays

Syntax

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

Description

[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.

Examples

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]
Was this topic helpful?