Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: switch Up: Programming Constructs Previous: while

for

This command is often not needed because matlab functions (sin for example) often work on whole arrays. The loop below adds an element to back on each iteration.
back=[];
for k=10: -1 : 1,
   back=[back,k]
end



© Cambridge University Engineering Dept
Information provided by Tim Love
2006-07-24