transforming cells having multi-dimensional matrics to 2-dimensional matrix.

1 vue (au cours des 30 derniers jours)
som
som le 13 Oct 2013
Commenté : Azzi Abdelmalek le 13 Oct 2013
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.

Réponses (1)

Azzi Abdelmalek
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
som
som le 13 Oct 2013
thanks for your responce. But I thik it doesn't give the ZZ matrix as I want. Do you have any other idea? Thanks
Azzi Abdelmalek
Azzi Abdelmalek le 13 Oct 2013
You did not reply to my above comment

Connectez-vous pour commenter.

Catégories

En savoir plus sur Mathematics and Optimization 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