swap x and y axis in a matrix
조회 수: 33 (최근 30일)
이전 댓글 표시
I would like to swap x and y axis in a matrix with n rows and two columns.
I have [r1 r2] and I would like to convert it to [r2 r1]
Thanks in advance for any answers!
댓글 수: 0
채택된 답변
Jos (10584)
2016년 5월 31일
M = [1 10 ; 2 20 ; 3 30]
Mnew = M(:,[2 1]) % by far the easiest
New = fliplr(M)
댓글 수: 0
추가 답변 (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!