Problem of inserting values into array within a for loop
Show older comments
Has anyone else met with the problem of MATLAB not liking to assign values to matrix in a for loop? E.g.
for i = 1:14
targetLabel = BLOB_STATS(i,1);
blob = (bm == targetLabel);
perimeterLength = regionprops(blob, 'Perimeter');
BLOB_STATS(i,3) = perimeterLength;
end
But if I use fixed coordinates, e.g. BLOB_STATS(1,3) = perimeterLength; it works fine.
The error I get says: "The following error occurred converting from struct to double: Error using double Conversion to double from struct is not possible."
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!