Skip to main content
1-Visitor
Oct 22, 2014 6:56 PM UTC
Solved

sort matrix

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.

LucMeekesAnswer
23-Emerald V
Oct 22, 2014 7:52 PM UTC

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

Success!
Luc

2 replies

LucMeekes23-Emerald VAnswer
23-Emerald V
Oct 22, 2014 7:52 PM UTC

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

Success!
Luc

Translate
payman1-VisitorAuthor
1-Visitor
Oct 22, 2014 8:10 PM UTC

Thank you.

Translate