convert matrix
조회 수: 1 (최근 30일)
이전 댓글 표시
how can I convert a 6-dimensional matrix into a matrix of dimension 4 then 2
댓글 수: 1
Jan
2011년 6월 1일
To let us understand what you are looking for, explain: SIZE(Inputs), kind of operation, SIZE(Outputs).
답변 (4개)
Jan
2011년 6월 1일
A 6-dimensional array (a "matrix" has 2 dimensions):
X = rand(2,3,4,5,6,7);
It is impossible to reshape this to the dimensions [4 x 2], which would be a matrix. So actual I believe that RESHAPE will do what you want, but a further explanaiotion of the wanted result is needed.
댓글 수: 0
Andrei Bobrov
2011년 6월 1일
A = rand(6,1) % array dimension 6x1
out = reshape(A,4,2);
댓글 수: 3
Jan
2011년 6월 1일
What is "dimension 4"? Please try to use a proper Matlab terminology. See the commands SIZE and NDIMS.
I do not see any way to face the fact, that you do not "want" to use RESHAPE. Either RESHAPE creates the correct results, or you are looking for something else but did not explain it very well -- in both cases "wanting" does not matter.
Laura Proctor
2011년 6월 1일
The results below will reshape from a 6D to a 4D array. If you don't want to use reshape, is there something else you have in mind?
A = rand(8,8,3, 3, 32, 32);
B = reshape(A,[],64,8,6);
댓글 수: 8
Matt Fig
2011년 6월 1일
@Jan: No. I simply don't understand the way samia is doing this. The smallest I for which I can get the code to produce a 6D gr9 is:
I = round(rand(12,12)*200);
which produces a gr9 of size [3 3 3 3 2 2]. This I can actually trace through and look at how the elements of gr9 are taken, but I see no clear patter that I think would extend to I 256-by-256... With the latter I of course there is no chance of tracing through!
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!