| Mapping Toolbox | ![]() |
Extracting Polygon or Line Segments
It may be difficult to identify line or patch segments once they have been combined into large NaN-clipped vectors. You can separate these polygon or line vectors in their component segments using polysplit. The results is cell arrays in which each element contains a segment. To reverse the results of polysplit, use polyjoin.
[latc,lonc] = polysplit(lat,long);
[latc{2} lonc{2}]
ans =
43.9 0
-67.14 -114.2
90 -18
-89 0
[lat2,lon2] = polyjoin(latc,lonc);
[lat long]
ans =
45.6 13
-23.47 -97.45
78 165
NaN NaN
43.9 0
-67.14 -114.2
90 -18
-89 0
| Segments versus Polygons | Merging Line Segments | ![]() |