[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sort two vectors
From: |
Carlo de Falco |
Subject: |
Re: Sort two vectors |
Date: |
Fri, 22 May 2009 16:10:21 +0200 |
On 22 May 2009, at 15:58, Xin Dong wrote:
Hi,
I have two vectors, one for distance information, the other for
correlation data which are stored in the corresponding positions as
the distance data. I wanna sort the distance vector and also sort
the correlation data according to the changes in the distance
vector. How can I do that?
Thanks,
Xin
assume your two vectors are
>> distance = rand(10,1);
>> correlation_data = rand(10,1);
you can do
>> [distance, idx] = sort(distance);
>> correlation_data = correlation_data (idx);
HTH,
c.