필터 지우기
필터 지우기

swap rows and columns of a matrix

조회 수: 4 (최근 30일)
Shyam Mudiraj
Shyam Mudiraj 2013년 5월 23일
What is an elegant way of reordering rows and columns of matrix when given a new order.
Ex:
A is 3 X 3 matrix
If the new order is [2 1 3], then I want to change A such that
1st row of A_New = 2nd row of A
2nd row of A_New = 1st row of A
3rd row of A_new = 3rd row of A
and
1st column of A_New = 2nd column of A
2nd column of A_New = 1st column of A
3rd column of A_new = 3rd column of A

채택된 답변

James Tursa
James Tursa 2013년 5월 23일
편집: James Tursa 2013년 5월 23일
x = [2 1 3];
A_New = A(x,x);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by