Path: news.mathworks.com!newsfeed-00.mathworks.com!news.kjsl.com!newsfeed.stanford.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: Thu, 11 Oct 2007 13:10:32 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 13
Message-ID: <fel7c8$ehk$1@canopus.cc.umanitoba.ca>
References: <1191983851.468137.61110@r29g2000hsg.googlegroups.com> <feho22$2kd$1@canopus.cc.umanitoba.ca> <1192073517.687686.113540@19g2000hsx.googlegroups.com> <fek5pq$qi8$1@canopus.cc.umanitoba.ca>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1192108232 14900 192.70.172.160 (11 Oct 2007 13:10:32 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Thu, 11 Oct 2007 13:10:32 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:432417



In article <fek5pq$qi8$1@canopus.cc.umanitoba.ca>,
Walter Roberson <roberson@ibd.nrc-cnrc.gc.ca> wrote:

>[vals,order] = cellfun(@(v) v{4},AA);
>sortedAA = AA(order);

Sorry, I did test, but I mistyped when I posted.

[vals,order] = sort(cellfun(@(v) v{4},AA));
sortedAA = AA(order);
-- 
   "Beware of bugs in the above code; I have only proved it correct,
   not tried it."                                    -- Donald Knuth