Store a variable in a loop

조회 수: 2 (최근 30일)
Rafael Freire
Rafael Freire 2012년 2월 6일
How 1 store a variable in this loop
for i=[0 0.01 0.5 0.6 1 1.2 1.5]
stored(i, 1)=1+i
end
best regards

채택된 답변

Kevin Holst
Kevin Holst 2012년 2월 6일
how about something simple like this?
n = [0 0.01 0.5 0.6 1 1.2 1.5];
for i = 1:length(n)
stored(i,1) = 1 + n(i);
end
or just
stored = [0 0.01 0.5 0.6 1 1.2 1.5]';

추가 답변 (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