Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

how can i store all simulation results from gibbs sampling ?

Asked by arkedia on 29 Nov 2012

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????

0 Comments

arkedia

Products

No products are associated with this question.

1 Answer

Answer by Muruganandham Subramanian on 29 Nov 2012
Accepted answer

Check this:

for i=1:3

    a{i}=i*ones(3);

end

b=cell2mat(a)

2 Comments

arkedia on 2 Dec 2012

thanks for the answer , but the result will be [111222333;111222333;111222333] and the result i want is to be horizontal as [111;111;111;222;222;222;333;333;333] is it possible??

try this:

for i=1:3
      a{i}=i*ones(3);
      d(:,:,i)=a{i};
end
Muruganandham Subramanian

Contact us