Path: news.mathworks.com!not-for-mail
From: "Amanda " <ahulse@tamu.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Counting Genotypes from Alleles
Date: Tue, 29 Mar 2011 19:29:21 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 24
Message-ID: <imtbuh$f61$1@fred.mathworks.com>
References: <imt4a8$nh$1@fred.mathworks.com> <imt68m$4s1$1@fred.mathworks.com>
Reply-To: "Amanda " <ahulse@tamu.edu>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1301426961 15553 172.30.248.46 (29 Mar 2011 19:29:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 29 Mar 2011 19:29:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2799804
Xref: news.mathworks.com comp.soft-sys.matlab:718896

"Florin Neacsu" <fneacsu2@gmail.com> wrote in message <imt68m$4s1$1@fred.mathworks.com>...
> "Amanda " <ahulse@tamu.edu> wrote in message <imt4a8$nh$1@fred.mathworks.com>...
> > I am trying to count the number of times a combination of alleles occur in a single matrix. Does anyone know how to write a correct function for this? I have looked into the 'unique' command however it does not seem to give me the correct number.
> > 
> > For example for the following vector, how many times does A occur in column 1 along with A in column 2. 
> > vec=[A A
> > A A
> > A A
> > A a
> > A A
> > a a]
> > Where the answer would be 4. 
> > Thank you!
> 
> Hi,
> 
> try ismember :
> >sum(ismember(vec,[A A],'rows'))
> 
> Regards,
> Florin


Thank you!