Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: sorting cell
Date: Sun, 28 Jun 2009 12:22:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 24
Message-ID: <h27n99$fbi$1@fred.mathworks.com>
References: <h275h5$5tq$1@fred.mathworks.com> <30304573.41024.1246178507734.JavaMail.jakarta@nitrogen.mathforum.org> <h27f6i$e6u$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 1246191722 15730 172.30.248.37 (28 Jun 2009 12:22:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 28 Jun 2009 12:22:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1886545
Xref: news.mathworks.com comp.soft-sys.matlab:551198


I feel kinda sorry and i think that one chance may be given from time to time.
To: Parham
Read the code and the help files of the functions in order to understand how they work. Don't ask just to solve problems for u. This is a long run-advice.

% Your example:
c={{83 83 83 84 85 86 86 86 94} {15 18 19 19 20 12 15 16 15} {'b' 'c' 'a' 't' 'f' 'r' 'd' 'r' 'x'}};

% Counts the number of types of information
Col = size(c,2);

% CONDITION if u have all "Col" datatypes for every entry
if ~all(diff(cellfun(@numel, c))) 
    % Flattening (this is my/Bruno's :) function) http://www.mathworks.com/matlabcentral/fileexchange/24544
    c = flatcell(c);
    % Reshaping
    c = reshape(c, [], Col);
    % Sorting by the first and then by the second
    c = sortrows(c, [1 2]);
else
    display('Missing data')
end


By the way, there is also this tool that may come in handy http://www.mathworks.com/matlabcentral/fileexchange/14225