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일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2014년 11월 28일

답변:

2014년 11월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by