Help CenterHelp Center
Access polyshape regions
polyshape
polyout = regions(polyin)
example
polyout = regions(polyin) returns a vector of polyshape objects whose elements are the solid regions of the input polyshape.
polyin
collapse all
Compute a polygon with two solid regions. Then, create a vector whose elements are a single region of the polygon.
P = [0 0; 0 2; 2 2; 2 0; NaN NaN; 0.5 0.5; 0.5 1.5; 1.5 1.5; 1.5 0.5; NaN NaN; 3 0.5; 3.5 1.5; 4 0.5; NaN NaN; 3.25 0.6; 3.75 0.6; 3.5 1]; polyin = polyshape(P); plot(polyin) xlim([-0.5 4.5]) ylim([-0.5 2.5])
polyout = 2x1 polyshape array with properties: Vertices NumRegions NumHoles
plot(polyout(1)) xlim([-0.5 4.5]) ylim([-0.5 2.5])
plot(polyout(2)) xlim([-0.5 4.5]) ylim([-0.5 2.5])
Input polyshape, specified as a scalar.
Data Types: polyshape
boundary | sortregions | polyshape | holes
boundary
sortregions
holes
You have a modified version of this example. Do you want to open this example with your edits?
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office