transforming cells having multi-dimensional matrics to 2-dimensional matrix.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I have a cell named Z whose elemnts are 3-dimensional matrixs as following:
z{1,1}=ones(nsm,nr, num_class)*10;
z{1,2}=ones(nsm,nr, num_class)*15;
z{1,3}=ones(nsm,nr, num_class)*20;
z{2,1}=ones(nsm,nr, num_class)*100;
z{2,2}=ones(nsm,nr, num_class)*150;
z{2,3}=ones(nsm,nr, num_class)*200;
I want to put together all members of Z and form a matrix named ZZ, like below:
ZZ=[10 10 10 15 15 15 20 20 20;
10 10 10 15 15 15 20 20 20;
10 10 10 15 15 15 20 20 20;
10 10 10 15 15 15 20 20 20;
100 100 100 150 150 150 200 200 200;
100 100 100 150 150 150 200 200 200;
100 100 100 150 150 150 200 200 200;
100 100 100 150 150 150 200 200 200;];
How can I do it. Any help would be appreciated.
Thanks in advance.
1 commentaire
Réponses (1)
Azzi Abdelmalek
le 13 Oct 2013
nsm=4,
nr=3,
num_class=2
z{1,1}=ones(nsm,nr, num_class)*10;
z{1,2}=ones(nsm,nr, num_class)*15;
z{1,3}=ones(nsm,nr, num_class)*20;
z{2,1}=ones(nsm,nr, num_class)*100;
z{2,2}=ones(nsm,nr, num_class)*150;
z{2,3}=ones(nsm,nr, num_class)*200;
zz=cell2mat(z)
2 commentaires
Voir également
Catégories
En savoir plus sur Mathematics and Optimization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!