Thread Subject: How to sort the data by the index value?

Subject: How to sort the data by the index value?

From: Hero Lee

Date: 15 Feb, 2008 23:40:22

Message: 1 of 2

Dear Sir or Madam,

I'd like to sort the data by the index value with
ascending order and assume that there is a matrix A,
including 4 tuples:

A:
[ 0.3 0.7 0.9
 -0.2 1.1 0.8
  0.6 -0.1 -0.7
  0.1 0.3 -0.2 ]

In A, each row is a tuple (index value, data1, data2)
Then, I'd like to sort each tuple with by the index
value with ascending order.

Also, it can be describred by A':

[ -0.2 1.1 0.8
   0.1 0.3 -0.2
   0.3 0.7 0.9
   0.6 -0.1 -0.7 ]

Therefore, how can I transform A into A' by Matlab codes?
Thank you so much!!

Subject: How to sort the data by the index value?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 15 Feb, 2008 23:46:43

Message: 2 of 2

In article <fp57t6$7ah$1@fred.mathworks.com>,
Hero Lee <hero@mathworks.com> wrote:

>I'd like to sort the data by the index value with
>ascending order and assume that there is a matrix A,
>including 4 tuples:

>A:
>[ 0.3 0.7 0.9
> -0.2 1.1 0.8
> 0.6 -0.1 -0.7
> 0.1 0.3 -0.2 ]

>In A, each row is a tuple (index value, data1, data2)
>Then, I'd like to sort each tuple with by the index
>value with ascending order.

sortrows(A);
--
  "To the modern spirt nothing is, or can be rightly known,
  except relatively and under conditions." -- Walter Pater

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com