How can I reshape a 3D matrix without changing the order of the data
조회 수: 3 (최근 30일)
이전 댓글 표시
This is probably really simple, but I have a 3D matrix A, 10x30x5 where 5 is the number of replicates in my study and the 10x30 is the actual data. I want the number of replicates to be in the first dimension rather than the third so that A' is a 5x10x30. A(2,2,1) should be equal to A'(1,2,2) . But I have no idea how to do this.
댓글 수: 0
채택된 답변
Jonathan Sullivan
2013년 7월 2일
Use the function permute. It switches the order of the dimensions.
You would want something like:
A = permute(A,[3 1 2]);
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!