How to save for loop data into vector

1 回表示 (過去 30 日間)
Veronika
Veronika 2014 年 11 月 28 日
回答済み: Guillaume 2014 年 11 月 28 日
Dear all, I have this simple code:
for s = 0.0:0.1:1
disp(s)
end
I want to save data from this for loop into a vector. How can I do this?
Thank you for answers.

採用された回答

Guillaume
Guillaume 2014 年 11 月 28 日
v = 0:0.1:1 %?
Or if you really want to be inefficient and use a loop:
idx = 1;
for s = 0:0.1:1
v(idx) = s;
idx = idx + 1;
end

その他の回答 (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