Possible Duplicates:
Matlab - building an array while looping
Matrix of unknown length in MATLAB?
How do you put all of the "a" values together to form a vector?
for i=1:3
a=2+i
end
Also this is maybe a style question but when do you put a semicolon after the end in a for loop such as the one above, also is it proper to put a semicolon after the first line?