how to change the increment in for loop?
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I have this line of code in C++ and I need to know its equivalent in Matlab:
for (i =0 , i<100 , i=i+4)
?
0 个评论
采纳的回答
madhan ravi
2018-8-1
编辑:madhan ravi
2018-8-1
hi, this is how you do it:
for i = 0:4:(100-1)
i
end
EXPLANATION: O IS THE STARTING POINT AND 4 IS THE INCREMENT , IT GOES ALL THE WAY UP UNTIL THE LIMIT (100-1)<=>99
更多回答(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!