area = vertcat(stats1.Area);
circularity = vertcat(stats1.Circularity);
solidity = vertcat(stats1.Solidity);
eccentricity = vertcat(stats1.Eccentricity);
equivdiameter = vertcat(stats1.EquivDiameter);
eulernumber = vertcat(stats1.EulerNumber);
major = vertcat(stats1.MajorAxisLength);
minor = vertcat(stats1.MinorAxisLength);
perimeter = vertcat(stats1.Perimeter);
However, your line
p(k,:)=[area,circularity,solidity,eccentricity,equivdiameter,eulernumber,major,minor,perimeter];
is going to have problems. You are going to need to turn p into a cell array.
The difficulty you are having is that you are assuming that your Y only has a single region in it. Now, it might be the case that you want to use bwareafilt() to pick out only the largest of the regions, but unless you do something like that, you are going to be getting multiple regions.
Best Answer