Problem of inserting values into array within a for loop
显示 更早的评论
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."
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!