Answers for "matlab sorting rows by one column"

0

matlab sorting rows by one column

>> A = [1,1,1;0,0,0;2,2,2]

A =

     1     1     1
     0     0     0
     2     2     2

>> [~,idx] = sort(A(:,1))

idx =

     2
     1
     3

>> A = A(idx,:)

A =

     0     0     0
     1     1     1
     2     2     2

>>
Posted by: Guest on September-06-2021
0

matlab sorting rows by one column

>> A = [1,1,1;0,0,0;2,2,2];

A =

     1     1     1
     0     0     0
     2     2     2

>> B = sortrows( A, 1 );

B =

     0     0     0
     1     1     1
     2     2     2
Posted by: Guest on September-06-2021

Code answers related to "matlab sorting rows by one column"

Browse Popular Code Answers by Language