i want to store all iteration value in the variable.

2 次查看(过去 30 天)
every time the loop are executing then the previous value are overwritten. so please give valuable solution.

采纳的回答

madhan ravi
madhan ravi 2018-12-30
Here is an example to avoid overwriting in a loop:
c=zeros(1,10); % preallocate for speed and efficiency
for i = 1:numel(c)
c(i)= 2^(i);
end
c

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by