for

Parent Previous Next

for





for var = expression



 ...



end


Notes

  • expression should be evaluated as a vector.

Examples

In these examples, the for block across multiple lines is pasted (control-V'ed) on 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 entire looping block can be placed on one line.

AUX> count = 0; for k=[2 8 1 4], count += k, end

Created with the Personal Edition of HelpNDoc: Easily create PDF Help documents