For loop increment value

3 ビュー (過去 30 日間)
David Castano
David Castano 2022 年 11 月 30 日
回答済み: Steven Lord 2022 年 11 月 30 日
i wanna create a for loop that creates 10x1 matrix that starts at 2 and increases by .1 in each row. not sure how to approach it. I would like to know the general approach for for loop increment values. Thank You!

回答 (1 件)

Steven Lord
Steven Lord 2022 年 11 月 30 日
See the "Decrement Values" example on the documentation page for the for keyword. Though in the case you described, you don't need to use a for loop. Using the colon function or : operator will do if you call the transpose function or use the .' operator on the result to make it a column vector instead of a row vector.

カテゴリ

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