How to rearrange matrix columns?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ASHA PON
am 25 Jan. 2023
Kommentiert: ASHA PON
am 25 Jan. 2023
I am having 7*7 matrix. Now i need to rearrange the matrix colums in such a way that last column of the matrix will be considered first column and first column as second, second column as third and so on.
Example:
A=[0 0 0 1 0 0 0
0 1 0 0 0 0 0
0 0 0 0 1 0 0
1 0 0 0 0 0 0
0 0 0 0 0 1 0
0 0 1 0 0 0 0
0 0 0 0 0 0 1]
Expected output:
Example:
B=[0 0 0 0 1 0 0
0 0 1 0 0 0 0
0 0 0 0 0 1 0
0 1 0 0 0 0 0
0 0 0 0 0 0 1
0 0 0 1 0 0 0
1 0 0 0 0 0 0]
0 Kommentare
Akzeptierte Antwort
Arif Hoq
am 25 Jan. 2023
A=[0 0 0 1 0 0 0
0 1 0 0 0 0 0
0 0 0 0 1 0 0
1 0 0 0 0 0 0
0 0 0 0 0 1 0
0 0 1 0 0 0 0
0 0 0 0 0 0 1];
B= circshift(A,1,2)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Elementary Math finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!