フィルターのクリア

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 Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by