%% Area of Polygon
% Create a polygon containing multiple solid regions and one hole, and compute its area.

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];
polyin = polyshape(P);
plot(polyin)
axis equal
A = area(polyin)

% Copyright 2012 The MathWorks, Inc.