Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <brunoluong@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re:
Date: Fri, 30 Nov 2007 23:33:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 24
Message-ID: <fiq6je$k8t$1@fred.mathworks.com>
References: <fiq28t$6qq$1@fred.mathworks.com> <fiq3pf$4oc$1@canopus.cc.umanitoba.ca> <fiq5me$64a$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <brunoluong@yahoo.com>
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 1196465582 20765 172.30.248.37 (30 Nov 2007 23:33:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 30 Nov 2007 23:33:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1184112
Xref: news.mathworks.com comp.soft-sys.matlab:440299



"David Doria" <daviddoria@gmail.com> wrote in message
<fiq5me$64a$1@fred.mathworks.com>...
> that actually might work in this case since i'll probably
> have a one to one mapping from character sets to summed
> ascii numbers.  however, if i was not sure i would have this
> one to one mapping , my original question of whether there
> is some sort of function that already does this holds.
> 

Can you just call two modes, one for char, once for integer?

c={1 2 1 'a' 3 'b' 'a' 2 'a' 10};

[mostc fc]=mode(double(cell2mat(c(cellfun(@ischar,c)))))
[mosti fi]=mode(double(cell2mat(c(cellfun(@isnumeric,c)))))

if fc>fi % char wins
  mostelem=char(mostc)
else % integer wins
  mostelem=mosti
end

Bruno