How to store all values resulting from loop

2 vues (au cours des 30 derniers jours)
maha lakshmi
maha lakshmi le 5 Mar 2013
Hi, Here disp(k1) gives all the values resulting from the for loop.But it store only the last value.How do I store all the values resulting from the for loop. for k=1:70
E_distym(k) = sqrt(sum((featureQ-A(k)).^2));% creating Euclidean distance database for 70 imagesa end A1=[]; for k1=1:70
if(E_distym(k1)<30)
disp(k1);
A1=k1;
end
I

Réponse acceptée

TAB
TAB le 5 Mar 2013
k1_stored = zeros(70,1);
for k1=1:70
if(E_distym(k1)<30)
disp(k1);
k1_stored(kl) = k1;
A1=k1;
end
end
  3 commentaires
TAB
TAB le 5 Mar 2013
Modifié(e) : TAB le 5 Mar 2013
After for loop
resultant = k1_stored(k1_stored~=0);
maha lakshmi
maha lakshmi le 5 Mar 2013
Thank you sir,it works.can you please tell how to display the corresponding images from the resultant(same name as the values in the resultant).

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by