why overwrite cell in loop matlab?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi
I try to calculate the distance of some picture, But on this Code, just remain the matrix distance of final picture.
Of course I see By F10 each output of distance of the points x1{i},y1{i} of the picture
image 1 have 15 points
image 2 have 22 points
image 3 have 18 points,... and mage 6, have 47 points,
this picture, result showed run my code that remain the matrix distance of final image.
vecPoint{i}=[x1{i},y1{i}];
[m{i} n{i}] = size(vecPoint{i});
n{i} = m{i};
Dist{i} = zeros(m{i}, n{i});
for ii = 2 : m{i}
for jj = 2 : n{i}
%%%%%%%%%%%%%%% Here %%%%%%%%%%%%%%%%%%%%%%%%%
Dist{jj,ii} = sqrt((vecPoint{i}(ii, 1) - vecPoint{i}(jj, 1)) ^ 2 + ...
(vecPoint{i}(ii, 2) - vecPoint{i}(jj, 2)) ^ 2);
end
end
2 件のコメント
Image Analyst
2019 年 12 月 26 日
Well it's doing what you're telling it to do. But what I don't know, is what you want it to do. What value does the poorly-named "i" have? Is that the loop iterator over images from 1 to 6? So all of that code is actually part of the inside of a loop over i? Why are you not using pdist2()? Do you not have the stats toolbox?
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Read, Write, and Modify Image についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!