MATLAB: How to save vectors in for loops

for loopvector

Dears, I want to know how can I save vectors in 3(or more) for loops My code is huge and I summarize it here.
for i=1:10
for j=1:15
for k=1:20
% some calculation
Vector1= something with size(1x2000) % size of Vector1 will be changed in each loop
end
end
end
finally I would like to attach all of Vector1 to one vector and capable to find the special array is related to which i and j and k.

Best Answer

Since the length of the vector will change in each loop, I would use a cell array and a counter:
k1 = 0;
for i=1:10
for j=1:15
for k=1:20
% some calculation
k1 = k1 + 1;
Vector1{k1} = something with size(1x2000) % size of Vector1 will be changed in each loop
end
end
end