Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: sorting an array
Replies: 1   Last Post: Feb 2, 2014 3:09 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Narayanan

Posts: 14
Registered: 6/10/13
sorting an array
Posted: Feb 2, 2014 2:39 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I have a matrix of size 7 x 2. The first column numbers 1 to 33. It is like this
A=[1 0.743
2 0.734
3 0.843
4 0.694
5 0.274
6 0.458
7 0.358]

Now I want to arrange the second column in descending order and the first column must also move correspondingly. If B is the output
B=[5 0.274
7 0.358
6 0.458
4 0.694
2 0.734
1 0.743
3 0.843].

I can't use the command B=sort(A,2,'descend') as the corresponding first column is wrong. Kindly help me.


Date Subject Author
2/2/14
Read sorting an array
Narayanan
2/2/14
Read Re: sorting an array
Bruno Luong

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.