How do I create an array of scalars?
9 views (last 30 days)
Show older comments
I want to make a list of the major and minor axis of several different functions. I made a loop loop that runs images from 1:10. Given, I can already get the reading of each axis, what is wrote with this code?
for j = 1:10,
...
Major_I(j,1) = regionprops(CC,'MajorAxisLength')
Minor_I(j,1) = regionprops(CC,'MinorAxisLength')
end
This loop only returns: Major_I =
10x1 struct array with fields: MajorAxisLength
Minor_I =
10x1 struct array with fields: MinorAxisLength
Accepted Answer
Fangjun Jiang
on 30 Aug 2011
That is because regionprops() returns a structure. Type Major_I.MajorAxisLength and Minor_I.MinorAxisLength in Command Window should give you the scalar numbers. Some of them may be empty. You can convert them to vector if you want. Something like
a=[Major_I.MajorAxisLength]
b=Minor_I.MinorAxisLength
4 Comments
More Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!