From: wapo <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Counting elements in a matrix
Date: Tue, 17 Feb 2009 00:12:30 -0800 (PST)
Lines: 29
Message-ID: <>
References: <gndr1j$6th$>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: 1234858350 2595 (17 Feb 2009 08:12:30 GMT)
NNTP-Posting-Date: Tue, 17 Feb 2009 08:12:30 +0000 (UTC)
Injection-Info:; posting-host=; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: 
	Gecko/2009011913 Firefox/3.0.6,gzip(gfe),gzip(gfe)
Xref: comp.soft-sys.matlab:518766

On Feb 17, 9:04=A0am, "Raghavasimhan Thirunarayanan"
<> wrote:
> Hi all,
> =A0I would like to know whether it is possible to list all the elements i=
n an arbitrary matrix and the number of times they appear. For example if m=
y matrix is
> [ 1,2,3; 3,4,5; 5,6,7]
> the program should list as follows
> element =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 no of appearances
> =A0 =A0 1 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
> =A0 =A0 2 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
> =A0 =A0 3 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
> =A0 =A0 4 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
> =A0 =A0 5 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
> =A0 =A0 6 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
> =A0 =A0 7 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
> I would much appreciate if anyone can help regarding this.
> Thanks in advance

If m is your matrix then hist(m(:))