MATLAB: How can i store all simulation results from gibbs sampling

for example : for i=1:3 b=n*ones(3) end the result will be [3 3 3;3 3 3;3 3 3] BUT i want to save the hole result as [1 1 1;1 1 1;1 1 1;2 2 2;2 2 2;2 2 2;3 3 3;3 3 3;3 3 3] How can i do it????

Best Answer

Check this:
for i=1:3
a{i}=i*ones(3);
end
b=cell2mat(a)