Basic loop syntax in MATLAB: for k=1:n
20 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
What does it mean
for k=1:n
2 Kommentare
Walter Roberson
am 29 Mär. 2021
It is as described in the responses rom Sean and I, with n being 3.
Antworten (2)
Sean de Wolski
am 28 Jan. 2011
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 Kommentare
Walter Roberson
am 28 Jan. 2011
(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 Kommentare
Matt Fig
am 28 Jan. 2011
Jan, how do you remember these things! There are obviously no angry armadillos bouncing around in your head.
Walter Roberson
am 29 Mär. 2021
(The link mentioned by Jan moved to https://groups.google.com/g/comp.soft-sys.matlab/c/VHVkpxJoKMA/m/lMVgXwAYV-wJ )
Siehe auch
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!