Skip to main content
1-Visitor
October 22, 2014
Solved

sort matrix

  • October 22, 2014
  • 1 reply
  • 2772 views

Hello,

For a given matrix, I want to sort the first column in descending order WITH the corresponded component on the second column. I can't use the "sort" function since it changes the order of one column's elements only.

Could you please help me with this issue?

Thank you.

Best answer by LucMeekes

You should be using the csort(M,c) function, where you can sort matrix M on the values of column c.

Success!
Luc

1 reply

LucMeekes23-Emerald IVAnswer
23-Emerald IV
October 22, 2014

You should be using the csort(M,c) function, where you can sort matrix M on the values of column c.

Success!
Luc

payman1-VisitorAuthor
1-Visitor
October 22, 2014

Thank you.