Sort every single row
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Patrick
am 18 Feb. 2015
Bearbeitet: Stephen23
am 18 Feb. 2015
How can I sort every single row of a matrix in ascending order? For example [16 2 3 13; 5 11 10 8] becomes [2 3 13 16;5 8 10 11] Thanks for help!
0 Kommentare
Akzeptierte Antwort
per isakson
am 18 Feb. 2015
One way
M = [16 2 3 13; 5 11 10 8] ;
for rr = 1 : size( M, 1 )
M( rr, : ) = sort( M( rr , : ), 'ascend' );
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices 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!