Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

isShapeMultipart

True if polygon or line has multiple parts

Syntax

tf = isShapeMultipart(xdata, ydata)

Description

tf = isShapeMultipart(xdata, ydata) returns 1 (true) if the polygon or line shape specified by xdata and ydata consists of multiple NaN-separated parts (i.e. has inner or multiple polygon rings or multiple line segments). The coordinate arrays xdata and ydata must match in size and have identical NaN locations.

Examples

collapse all

Create a simple data set and check if it's multipart. If a data set contains NaN separators, isShapeMultipart returns 1 , otherwise 0.

sample_xdata = [0 0 1];
sample_ydata = [0 1 0];
isShapeMultipart(sample_xdata,sample_ydata)
ans =

  logical

   0

Create simple multipart data sets.

multi_xdata = [0 0 1 NaN 2 2 3 3];
multi_ydata = [0 1 0 NaN 2 3 3 2];
isShapeMultipart(multi_xdata,multi_ydata)
ans =

  logical

   1

Check a real data set.

load coastlines
isShapeMultipart(coastlat,coastlon)
ans =

  logical

   1

Check the data in a shapefile.

S = shaperead('concord_hydro_area');
isShapeMultipart(S(1).X, S(1).Y)
ans =

  logical

   0

Check another dataset in the shapefile.

isShapeMultipart(S(14).X, S(14).Y)
ans =

  logical

   1

See Also

Introduced in R2006a

Was this topic helpful?