Effacer les filtres
Effacer les filtres

how can i store all simulation results from gibbs sampling VERTICALLY?

5 vues (au cours des 30 derniers jours)
arkedia
arkedia le 2 Déc 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???? I'v got the following answer
For i=1:3
a{i}=i*ones(3);
end
b=cell2mat(a)
the result will be [111222333;111222333;111222333] BUT, the result i want is to be as [111;111;111;222;222;222;333;333;333] is it possible??

Réponses (2)

Muruganandham Subramanian
Muruganandham Subramanian le 6 Déc 2012
try this:
for i=1:3
a{i}=i*ones(3);
d(:,:,i)=a{i};
end

Andrei Bobrov
Andrei Bobrov le 6 Déc 2012
b = kron((1:3)',ones(3));

Catégories

En savoir plus sur General Applications dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by