Main Content

perimeter

Perimeter ofpolyshape

Description

example

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

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

This syntax is only supported whenpolyinis a scalarpolyshapeobject.

Examples

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); plot(polyin) axisequal

Figure contains an axes object. The axes object contains an object of type polygon.

P = perimeter(polyin)
P = 12

Input Arguments

collapse all

Inputpolyshape, 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 ofIcorresponds to a single boundary of the inputpolyshape.

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

Version History

Introduced in R2017b