Decrementing for loop in MATLAB
显示 更早的评论
Hello everyone,
I am new to MATLAB programming and I want to use a for loop starting with an index 5 and reducing to 1
Example in C++ I can write for int i = 5;i<=1;i--)
how can this be implemented in MATLAB
采纳的回答
更多回答(2 个)
yagnesh
2012-11-29
5 个投票
for i= 5:-1:1 %here we have used reverse for loop to overcome with error statement end
1 个评论
dhrumil sheth
2016-5-25
Very Good. It is really helpful for me
It is always a good idea to read the documentation in case of questions:
There you find a corresponding example.
类别
在 帮助中心 和 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!