For Loop Increment Value
47 ビュー (過去 30 日間)
古いコメントを表示
HARSHVARDHAN SARAVANAKUMAR
2017 年 2 月 11 日
コメント済み: HARSHVARDHAN SARAVANAKUMAR
2017 年 2 月 11 日
I am beginner in MATLAB. I want to write a for loop where the increment value should increase by 2.
For eg:
for i = 1:9
something
end
The value of i should be 1, 3, 5, 7, 9. Kindly help.
0 件のコメント
採用された回答
Geoff Hayes
2017 年 2 月 11 日
Just do
for k=1:2:9
% do something
end
where we have defined the step size to be two.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!