why overwrite cell in loop matlab?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
![maaathw.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/257204/maaathw.png)
2 commentaires
Image Analyst
le 26 Déc 2019
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?
Réponses (0)
Voir également
Catégories
En savoir plus sur Read, Write, and Modify Image dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!