Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (1)

Azzi Abdelmalek
Azzi Abdelmalek il 13 Ott 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 Commenti
som
som il 13 Ott 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

Accedi per commentare.

Categorie

Scopri di più su Agriculture in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by