error using squeeze function

조회 수: 6 (최근 30일)
kash
kash 2012년 3월 15일
i have values as
A(:,:,1)=
1 3 4
.2 .3 .9
;
;
;
A(:,:,56)=
10 13 9
1 2 20
i need to display as
A=
1 3 4
.2 .3 .9
;
;
10 13 9
1 2 20
i tried squeeze,but did not get exact answer,please help
  댓글 수: 2
Jan
Jan 2012년 3월 15일
Does "did not get the exact answer" means, that the answer is :_completely_ wrong - or only _partially_ wrong?!
I do not understand the notation with the semicolons. Please post what you try and how you insert the semicolons into the output.
Daniel Shub
Daniel Shub 2012년 3월 15일
How exactly do you expect to represent a 3D matrix in 2D?

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

답변 (2개)

Jan
Jan 2012년 3월 15일
Perhaps:
reshape(permute(A, [3,1,2]), 4, 3)
?
[EDITED] No, the above is not correct. Better:
reshape(permute(A, [1,3,2]), [], 3)
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 3월 15일
I think your reshape is wrong there. The original matrix size goes to at least 56 in the third dimension, so you are not going to fit the matrix in to a 4 x 3 .
Jan
Jan 2012년 3월 18일
Thanks Walter. Now I get an idea what the semicolons should mean.

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


Walter Roberson
Walter Roberson 2012년 3월 15일
squeeze() is only for eliminating singular dimensions, such as for transforming a 17 x 1 x 43 array in to a 17 x 43 array.
You do not have any singular dimensions, so squeeze() is not going to help you.
  댓글 수: 2
kash
kash 2012년 3월 17일
So walter how to process it ,please help
Walter Roberson
Walter Roberson 2012년 3월 17일
It'd probably take a permute() and reshape() and possibly a transpose after.

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

카테고리

Help CenterFile Exchange에서 Performance and Memory에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by