Store a variable in a loop

1 回表示 (過去 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 Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by