i want to store all iteration value in the variable.

조회 수: 2 (최근 30일)
GHUFRAN AHMAD KHAN
GHUFRAN AHMAD KHAN 2018년 12월 30일
답변: madhan ravi 2018년 12월 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