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.


Perimeter of polyshape


P = perimeter(polyin)
P = perimeter(polyin,I)



P = perimeter(polyin) returns the perimeter of a polyshape object, which is the sum of the lengths of its boundaries.

P = perimeter(polyin,I) returns the perimeter of the Ith boundary of polyin.

This syntax is only supported when polyin is a scalar polyshape object.


collapse all

Create a polygon with one hole, and compute its perimeter.

V = [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];
polyin = polyshape(V);
axis equal

P = perimeter(polyin)
P = 12

Input Arguments

collapse all

Input polyshape, specified as a scalar, vector, matrix, or multidimensional array.

Data Types: polyshape

Boundary index, specified as a scalar integer or vector of integers. Each element of I corresponds to a single boundary of the input polyshape.

Data Types: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

See Also

| |

Introduced in R2017b