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!