Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!m16g2000yqc.googlegroups.com!not-for-mail
From: steeve_dun <steeve_dun@yahoo.fr>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Sorting a cell array according to another
Date: Sun, 8 Nov 2009 10:39:40 -0800 (PST)
Organization: http://groups.google.com
Lines: 19
Message-ID: <162e913a-e9f9-42f0-9fff-280202444b4b@m16g2000yqc.googlegroups.com>
References: <92bcbdae-a733-4aab-81c6-f7f15b418fdc@m16g2000yqc.googlegroups.com> 
	<hd70e6$kf6$1@fred.mathworks.com>
NNTP-Posting-Host: 88.176.45.61
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1257705580 32180 127.0.0.1 (8 Nov 2009 18:39:40 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sun, 8 Nov 2009 18:39:40 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: m16g2000yqc.googlegroups.com; posting-host=88.176.45.61; 
	posting-account=iW7MyQoAAAD0jUvNeCvlnzmBCG3MRPQd
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; 
	Trident/4.0; GTB6; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; FDM; .NET 
	CLR 1.1.4322; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 
	3.5.30729; .NET CLR 3.0.30729; InfoPath.2; yie8),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:583384


On 8 nov, 18:51, "Miroslav Balda" <miroslav.nos...@balda.cz> wrote:
> steeve_dun <steeve_...@yahoo.fr> wrote in message <92bcbdae-a733-4aab-81c6-f7f15b418...@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

Thank you, that was very helpful