How to store all values resulting from loop

조회 수: 1 (최근 30일)
maha lakshmi
maha lakshmi 2013년 3월 5일
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

채택된 답변

TAB
TAB 2013년 3월 5일
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
TAB
TAB 2013년 3월 5일
편집: TAB 2013년 3월 5일
After for loop
resultant = k1_stored(k1_stored~=0);
maha lakshmi
maha lakshmi 2013년 3월 5일
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).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by