MATLAB: How to save each iteration of the while loop as an array I can reference

iterationMATLABwhile loops

When I run this, I can see each iteration of the loop in my command window, but I cannot figure out how to save each iteration into an array that I can later reference. For example If later I wanted to plot specifically the array given when N = 100 from this loop. Each iteration is a different sized array so this is where I am having issues.
N = 10
while N<= 190
vector = r
r = 1+ (1000-1).*rand(N,1)
N = N + 10
end

Best Answer

You need to use cell array to store arrays of different sizes
N = 10
r = {};
while N<= 190
r{end+1} = 1 + (1000-1).*rand(N,1)
N = N + 10
end