Path: news.mathworks.com!newsfeed-00.mathworks.com!NNTP.WPI.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: "mode" function for mixed types
Date: Fri, 30 Nov 2007 22:45:03 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 22
Message-ID: <fiq3pf$4oc$1@canopus.cc.umanitoba.ca>
References: <fiq28t$6qq$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1196462703 4876 192.70.172.160 (30 Nov 2007 22:45:03 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Fri, 30 Nov 2007 22:45:03 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:440289



In article <fiq28t$6qq$1@fred.mathworks.com>,
David Doria <daviddoria@gmail.com> wrote:
>I have a cell array like

>[1] [1] [2] [a] [1] [a] [2] [a]

>and i want to determine which is the most frequently
>occurring "character" (similar to the "mode" of a strictly
>integer array).

>Is there a function that will do this?

hist() or histc(). The easiest way to convert the characters
to numbers is to add 0 to the character: e.g.,

 'hello' + 0

will be a numeric array of length 5 containing the numeric codes
for each character.
-- 
  "There are some ideas so wrong that only a very intelligent person
  could believe in them."                            -- George Orwell