Filter löschen
Filter löschen

Save arrow vector which changes its length during a loop

1 Ansicht (letzte 30 Tage)
Miguel Cardoso
Miguel Cardoso am 18 Feb. 2020
Kommentiert: Miguel Cardoso am 19 Feb. 2020
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 Kommentare
Alex Mcaulley
Alex Mcaulley am 19 Feb. 2020
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 am 19 Feb. 2020
Thank you guys, it helped me a lot, cell array helped me!

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by