Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!y42g2000hsy.googlegroups.com!not-for-mail
From:  "G.A.M." <x0Zero@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to sort cell array of cell arrays by inner value
Date: Thu, 11 Oct 2007 05:29:44 -0000
Organization: http://groups.google.com
Lines: 40
Message-ID: <1192080584.096393.43070@y42g2000hsy.googlegroups.com>
References: <1191983851.468137.61110@r29g2000hsg.googlegroups.com>
NNTP-Posting-Host: 76.122.60.107
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Trace: posting.google.com 1192080584 24592 127.0.0.1 (11 Oct 2007 05:29:44 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 11 Oct 2007 05:29:44 +0000 (UTC)
In-Reply-To: <fek5pq$qi8$1@canopus.cc.umanitoba.ca>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: y42g2000hsy.googlegroups.com; posting-host=76.122.60.107;
Xref: news.mathworks.com comp.soft-sys.matlab:432356



On Oct 10, 11:37 pm, rober...@ibd.nrc-cnrc.gc.ca (Walter Roberson)
wrote:
> In article <1192073517.687686.113...@19g2000hsx.googlegroups.com>,
>
> G.A.M. <x0Z...@gmail.com> wrote:
> >On Oct 10, 1:30 am, rober...@ibd.nrc-cnrc.gc.ca (Walter Roberson)
> >wrote:
> >> In article <1191983851.468137.61...@r29g2000hsg.googlegroups.com>,
> >> G.A.M. <x0Z...@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.
> >Here's some sample data.
> >I want to sort AA by the numeric values in the 4th column of the inner
> >cells.
>
> a = {'ay', 'd1', {'iala', 'lbb'}, 4}
> b = {'xi', 'a2', {'adoa', 'bab'}, 7}
> c = {'um', 'e3', {'caaa', 'cyb'}, 3}
> d = {'iw', '4t', {'ljik', 'lwb'}, 9}
> AA = {b, a, c, d}
>
> >This is how I'm indexing into the numeric values I want to use for
> >sorting:
> >AA{1}{4}
> >ans = 7
>
> [vals,order] = cellfun(@(v) v{4},AA);
> sortedAA = AA(order);
> --
>    "History is a pile of debris"                     -- Laurie Anderson

When I run this, I get this error:
Insufficient number of outputs from right hand side of equal sign to
satisfy assignment.

Seems like a separate call to sort() may be required. I was hoping for
a compact version like what was given here, but I can't seem to get it
to work.