save result in while loop
1 view (last 30 days)
Show older comments
I have a this code
index_A=[];
while (ibd <= max_it)
i=i+1;
index_A =[tt;index_A]
end
in i=1; index_A=[19;20].
in i=2; index_A=[14].
how I can save them all in index_A?
result should be=[19;20;14];
index_A(i) =[tt;index_A]
the above code is not working
2 Comments
Answers (1)
KSSV
on 18 Mar 2019
index_A=cell([],1);
while (ibd <= max_it)
i=i+1;
index_A{i}= t ;% save what you want ;
end
index_A = cell2mat(index_A) ;
3 Comments
See Also
Categories
Find more on Get Started with Optimization Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!