Basic loop syntax in MATLAB: for k=1:n
20 次查看(过去 30 天)
显示 更早的评论
What does it mean
for k=1:n
回答(2 个)
Sean de Wolski
2011-1-28
it means that everything between that line
k = 1:n
and
end
will be evaluated with k = every integer between 1 and n.
doc for
for more information
0 个评论
Walter Roberson
2011-1-28
(Adjusting Sean's answer):
it means that everything between that line
k = 1:n
and
end
will be evaluated with k = every integer starting at 1 and not exceeding n; no iterations will be done at all if n < 1
doc for
for more information
4 个评论
Matt Fig
2011-1-28
Jan, how do you remember these things! There are obviously no angry armadillos bouncing around in your head.
Walter Roberson
2021-3-29
(The link mentioned by Jan moved to https://groups.google.com/g/comp.soft-sys.matlab/c/VHVkpxJoKMA/m/lMVgXwAYV-wJ )
另请参阅
类别
在 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!