MATLAB: How to save each loop data in consecutive rows

regexpreshapesplit

i need to store the each iteration values in consecutive rows.how it is possible in matlab?
for i =1:3
a=rand(3,2);
b = reshape(a.',1,[]);
end
ex:
i=1; b= 0.1174 0.4242 0.2967 0.5079 0.3188 0.0855
i=2: b= 0.1174 0.4242 0.2967 0.5079 0.3188 0.0855
i=3; b= 0.9133 0.2619 0.7962 0.3354 0.0987 0.6797
output should be a variable(3*6)
0.1174 0.4242 0.2967 0.5079 0.3188 0.0855
0.1174 0.4242 0.2967 0.5079 0.3188 0.0855
0.9133 0.2619 0.7962 0.3354 0.0987 0.6797

Best Answer

b = zeros(3,2*3);
for k = 1:3
a = rand(3,2);
b(k,:) = reshape(a.',1,[]);
end
Note: Your output is 3 by 6, not 3 by 5.