From: bakero on
Hi everyone

I'd like to know if there is any instruction in matlab to sort a matrix like this example:

X =[ 0.506 0.258 0.478
201 203 202]

x_sorted = [0.258 0.478 0.506
203 202 201]

What I am looking for is to sort the first row in ascend way and moving the value on the second row which belongs to each first row index. For instance, if 0.506 is the maximum value on first row, put it into the last place and moving 201 with it.

I don't know whether this is possible or not.

Does anyone know how to do it?

Many thanks in advance

Regards.
From: Sean on
bakero <morien3(a)gmail.com> wrote in message <157383103.68823.1272970138577.JavaMail.root(a)gallium.mathforum.org>...
> Hi everyone
>
> I'd like to know if there is any instruction in matlab to sort a matrix like this example:
>
> X =[ 0.506 0.258 0.478
> 201 203 202]
>
> x_sorted = [0.258 0.478 0.506
> 203 202 201]
>
> What I am looking for is to sort the first row in ascend way and moving the value on the second row which belongs to each first row index. For instance, if 0.506 is the maximum value on first row, put it into the last place and moving 201 with it.
>
> I don't know whether this is possible or not.
>
> Does anyone know how to do it?
>
> Many thanks in advance
>
> Regards.

>>help sortrows

Good Luck!
 | 
Pages: 1
Prev: batch mode
Next: ODE system and derivative.