MATLAB: How to extract polygons coordinates from shape file

coordinatesextractpolygonshape file

hello, I have a shape file which contains 10 polygons I need to extract the coordinates for each polygon how can I do that ?
thanks,

Best Answer

S = shaperead(shapefile) ; % Read shape file
N = length(S) ; % total number of polygons
% GEt coordinates of each polygon
for i = 1:N
[S(i).X ;S(i).Y] ;
end