How to reshape and reorder a 5D arrays to 4D arrays?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello
I'm managing 192x192x20x8x2 dimension arrays. In my problem, I need to reshape the 5D array to 4D, and re-ordering the third dimension.
For example, I need to reorder the 5D arrays from [ : , : , 1 : 2 : 39 , : , 1 ] and [ : , : , 2 : 2 : 40 , : , 2 ] to the 4D arrays [ : , : , 1 : 40 , : ]
How could I do it? Thanks a lot!
댓글 수: 0
채택된 답변
Andrei Bobrov
2019년 6월 4일
Let A - your 5D array:
k = size(A);
out = zeros(k(1:end-1).*[1,1,2,1]);
out(:,:,1:2:end,:) = A(:,:,:,:,1);
out(:,:,2:2:end,:) = A(:,:,:,:,2);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!