필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
som
som 2013년 10월 13일
댓글: Azzi Abdelmalek 2013년 10월 13일
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개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 10월 13일
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
som
som 2013년 10월 13일
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 2013년 10월 13일
You did not reply to my above comment

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Agriculture에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by