Filter löschen
Filter löschen

what does it mean

1 Ansicht (letzte 30 Tage)
Shruti Rishi Raj
Shruti Rishi Raj am 7 Mär. 2015
Beantwortet: Image Analyst am 7 Mär. 2015
for k = (i-1):-1:1

Akzeptierte Antwort

Image Analyst
Image Analyst am 7 Mär. 2015
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.

Weitere Antworten (1)

rantunes
rantunes am 7 Mär. 2015
Hey
You can answer your question by running:
for k = (i-1):-1:1;
k
end
Greets
  1 Kommentar
rantunes
rantunes am 7 Mär. 2015
without the semi-colon in the end of the line of the for

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by