Path: news.mathworks.com!newsfeed-00.mathworks.com!NNTP.WPI.EDU!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to sort cell array of cell arrays by inner value
Date: Wed, 10 Oct 2007 05:30:42 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 14
Message-ID: <feho22$2kd$1@canopus.cc.umanitoba.ca>
References: <1191983851.468137.61110@r29g2000hsg.googlegroups.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1191994242 2701 192.70.172.160 (10 Oct 2007 05:30:42 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Wed, 10 Oct 2007 05:30:42 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:432113



In article <1191983851.468137.61110@r29g2000hsg.googlegroups.com>,
G.A.M. <x0Zero@gmail.com> wrote:
>I have a 1 x 500 cell array where each cell is a 1 x 4 cell array. The
>inner 1 x 4 cell array has a double numeric value in the 4th cell. I
>would like to sort the 500 cells by this numeric value. What is the
>best way to do this? Thanks

Use cellfun to extract just the value to be sorted on into an
array. Sort that array, using the two-output sort so that
you get the indices. Then index the original cell array at that
index list.

-- 
   "Okay, buzzwords only. Two syllables, tops."  -- Laurie Anderson