How to reverse a matrix dimension without affecting the other 2 (for 3 or more dimension matrixes)?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi,
I have a 3D matrix, let's say: A=rand(238,132,35). The problem is that the third dimension (the one with 35) is reversed and I need to turn it. It represents the depth in my case, and it needs to be not from 1 to 35 but from 35 to 1. And I need to do this without altering the other 2 dimensions. flipud obviously does not work for 3D matrix. Is there a flipud for 3D matrix? or any other way to do it?
Thanks,
Robert.
댓글 수: 0
채택된 답변
Oleg Komarov
2012년 3월 14일
A = rand(238,132,35);
A = A(:,:,35:-1:1);
flipdim(A,3)
where the 3 stands for the 3rd dimension.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!