Transpose a matrix within a matrix
이전 댓글 표시
I have a matrix that has X rows and 9 columns.
Each row is actually a 3x3 matrix.
I want to transpose all of those 3x3 matrixes. How can I do that?
댓글 수: 1
Cedric
2014년 7월 5일
Could you give an example with 2 rows, and show how you go from there to two 3 by 3 arrays?
채택된 답변
추가 답변 (1개)
the cyclist
2014년 7월 5일
I am not 100% confident that I understand what you are trying to do, but is this close?
x = rand(6,9)
[m,n] = size(x);
for i = 2:3:(m-1)
for j = 2:3:(n-1)
x(i-1:i+1,j-1:j+1) = x(i-1:i+1,j-1:j+1)';
end
end
카테고리
도움말 센터 및 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!