Save arrow vector which changes its length during a loop

1 次查看(过去 30 天)
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

请先登录,再进行评论。

回答(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