for
Form
for var = expression
...
end
Notes
expressionshould evaluate as a vector.
Examples
In the documented examples, a multi-line for block is pasted directly onto the AUXLAB command line.
AUX> count = 0;
for k=1:10
count += k
end
AUX> count
count =
55
AUX> count = 0;
for k=[2 8 1 4]
count += k
end
AUX> count
count =
15
The whole loop can also be written on one line:
AUX> count = 0; for k=[2 8 1 4], count += k, end
Current source basis:
for.htmlinhtml-CREATED