I want to arrange a 1st column of a matrix in descending order an the elements in the row is going to arrange itself according to change of the row of first vector
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Joy Mondal
am 23 Nov. 2021
Kommentiert: Joy Mondal
am 23 Nov. 2021
A= [3 2; 1 4; 2 6]
Taking the first coumn of matrix as base I want to change the other elements ie.
A=[ 3 2; 2 6; 1 4]
Ie entry to the rows going to arrange itself according to the first element of first column of matrix
0 Kommentare
Akzeptierte Antwort
Stephen23
am 23 Nov. 2021
The simple MATLAB approach:
A = [3,2;1,4;2,6]
B = sortrows(A,-1)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrices and Arrays 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!