Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: alphabetic ordering
Date: Thu, 8 Jan 2009 22:30:05 +0000 (UTC)
Organization: The MathWorks Inc
Lines: 22
Message-ID: <gk5upd$dvg$1@fred.mathworks.com>
References: <gk5u0u$m34$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1231453805 14320 172.30.248.37 (8 Jan 2009 22:30:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 8 Jan 2009 22:30:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869871
Xref: news.mathworks.com comp.soft-sys.matlab:510513


"kaori Joo" <rocio.joo@gmail.com> wrote in message <gk5u0u$m34$1@fred.mathworks.com>...
> Hi,
> I have a matrix like this:
>   Name                       Size              Bytes  Class 
> data                    3653x24            6436668  cell                
> 
> The first column has integers, the second one names (strings), the third one and the fourth one have dates (in string format), and all the other ones have just numbers. I want to sort the matrix by the alphabetical order of the column of names (second column), and then by dates (third column), and then the seventh column.
> 
> What should I do?
> 
> Kaori

Kaori,

You can use SORTROWS.

sortedData = sortrows(data, [2 3 7]);

*note: the dates will be sorted alphabetically. You may need to convert the dates to numbers (using DATENUM) before you do the sort.


jiro