필터 지우기
필터 지우기

Save arrow vector which changes its length during a loop

조회 수: 2 (최근 30일)
Miguel Cardoso
Miguel Cardoso 2020년 2월 18일
댓글: Miguel Cardoso 2020년 2월 19일
Hey!
I'm trying to save on my workspace an arrow variable (I & J) which shanges its length during the loop.
Hope you can help me!
for i=1:6
DR_min(i)=min(DR_new);
[row]=find(DR_new==DR_min(i));
I=IQ(row);
J=JQ(row);
DR_new(DR_new<=DR_min(i)) = NaN;
shells(i)=length(I)/16;
end
  댓글 수: 3
Alex Mcaulley
Alex Mcaulley 2020년 2월 19일
If I and J change their size you should use a cell array:
I = cell(1,6);
J = cell(1,6);
for i=1:6
DR_min(i)=min(DR_new);
[row]=find(DR_new==DR_min(i));
I{i}=IQ(row);
J{i}=JQ(row);
DR_new(DR_new<=DR_min(i)) = NaN;
shells(i)=length(I)/16;
end
Miguel Cardoso
Miguel Cardoso 2020년 2월 19일
Thank you guys, it helped me a lot, cell array helped me!

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

답변 (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