i want to store all iteration value in the variable.

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개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2018년 12월 30일

답변:

2018년 12월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by