Change column and row
Ältere Kommentare anzeigen
Hi, how can I change the positions of entire row and columns in a matrix [nxm]? For example, I want to change my entire 10th row and 10th column into entire 1st column and 1st row.
Thank you.
Akzeptierte Antwort
Weitere Antworten (1)
Ilham Hardy
am 22 Feb. 2016
Bearbeitet: Ilham Hardy
am 22 Feb. 2016
0 Stimmen
2 Kommentare
Ilham Hardy
am 22 Feb. 2016
For example,
matrix=[1 2 3 4 5;6 7 8 9 10; 11 12 13 14 15; 16 17 18 19 20];
>> matrix
matrix =
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
>> flipud(matrix)
ans =
16 17 18 19 20
11 12 13 14 15
6 7 8 9 10
1 2 3 4 5
>> fliplr(flipud(matrix))
ans =
20 19 18 17 16
15 14 13 12 11
10 9 8 7 6
5 4 3 2 1
nur yusof
am 22 Feb. 2016
Kategorien
Mehr zu Matrices and Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!