Path: news.mathworks.com!not-for-mail
From: "Miroslav Balda" <miroslav.nospam@balda.cz>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Sorting a cell array according to another
Date: Sun, 8 Nov 2009 17:51:02 +0000 (UTC)
Organization: Miroslav Balda
Lines: 16
Message-ID: <hd70e6$kf6$1@fred.mathworks.com>
References: <92bcbdae-a733-4aab-81c6-f7f15b418fdc@m16g2000yqc.googlegroups.com>
Reply-To: "Miroslav Balda" <miroslav.nospam@balda.cz>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257702662 20966 172.30.248.38 (8 Nov 2009 17:51:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 8 Nov 2009 17:51:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 360709
Xref: news.mathworks.com comp.soft-sys.matlab:583375


steeve_dun <steeve_dun@yahoo.fr> wrote in message <92bcbdae-a733-4aab-81c6-f7f15b418fdc@m16g2000yqc.googlegroups.com>...
> Hi,
> I have 2 cell arrays X and Y.
> I&#8217;ve sorted X with [a idx]=sort(X) and I would like Y to be sorted
> according to idx.
> Can anybody help please?
> Thanks in advance

Hi,

try this (for column vectors):

[xs,idx]=sort(x{:});
y{:}(idx,:);

Mira