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.
For loop increment value
4 次查看(过去 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!
0 个评论
回答(1 个)
另请参阅
类别
在 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!