what does it mean

2 次查看(过去 30 天)
for k = (i-1):-1:1

采纳的回答

Image Analyst
Image Analyst 2015-3-7
When you say
for k = start : step : stop
the first expression, (i-1) in your case, will be the first/starting value of the loop iterator k. Then the next iteration k will be start+step, or i-1-1 = i-2 in your case. It keeps going until it gets to the "stop" value or goes past it (i.e., goes above it if the step is positive, or below it if the step value is negative). This is basic stuff. Please read the getting started section of the help for more essential information.

更多回答(1 个)

rantunes
rantunes 2015-3-7
Hey
You can answer your question by running:
for k = (i-1):-1:1;
k
end
Greets
  1 个评论
rantunes
rantunes 2015-3-7
without the semi-colon in the end of the line of the for

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by