Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!news2!postnews.google.com!t3g2000yqa.googlegroups.com!not-for-mail
From: ImageAnalyst <imageanalyst@mailinator.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to find elements of a given value in a matrix?
Date: Mon, 29 Dec 2008 21:15:45 -0800 (PST)
Organization: http://groups.google.com
Lines: 21
Message-ID: <ae87e355-a3ff-4b24-ad25-f730c63da11c@t3g2000yqa.googlegroups.com>
References: <16525645.1230231468100.JavaMail.jakarta@nitrogen.mathforum.org>
NNTP-Posting-Host: 75.186.70.56
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1230614145 26321 127.0.0.1 (30 Dec 2008 05:15:45 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 30 Dec 2008 05:15:45 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: t3g2000yqa.googlegroups.com; posting-host=75.186.70.56; 
	posting-account=0rLUzAkAAABojYSRC64DkTbtiSCX77HH
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET 
	CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 
	3.5.21022),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:509179


On Dec 25, 1:56=A0pm, juckou <j...@hw.ac.uk> wrote:
> Dear all,
>
> I'm just trying to know how many elements in a matrix have a given value.=
 I mean, if I have a matrix A=3D[1 2 3; 1 2 3; 1 2 3] I want to know the nu=
mber (or the percentage) of elements that are "1" (3 or the 33,3% in this c=
ase).
>
> Any help?
> Thank you very much
>
> julio

------------------------------------
julio:
If you want to know for ALL numbers (e.g. 1, 2, and 3), then you can
use the hist() function.  If you want to know for only one certain
specific number, then you can use the methods the others have given
you.
Regards,
ImageAnalyst