Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!z11g2000prl.googlegroups.com!not-for-mail
From: Praetorian <ashish.sadanandan@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Find a vector in a matrix
Date: Wed, 13 Aug 2008 11:08:11 -0700 (PDT)
Organization: http://groups.google.com
Lines: 32
Message-ID: <b1c1e444-2ecc-415b-9a63-6091a98de9e7@z11g2000prl.googlegroups.com>
References: <g7v6be$t4$1@fred.mathworks.com>
NNTP-Posting-Host: 66.37.129.67
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1218650892 27275 127.0.0.1 (13 Aug 2008 18:08:12 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 13 Aug 2008 18:08:12 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: z11g2000prl.googlegroups.com; posting-host=66.37.129.67; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) 
Xref: news.mathworks.com comp.soft-sys.matlab:485318



On Aug 13, 11:41=A0am, "Jonathan " <n...@domain.com> wrote:
> Is there an easy way to find a vector in a matrix?
>
> for example
>
> =A0 =A0 =A01 =A0 =A0 1 =A0 =A0 1 =A0 =A0 1 =A0 =A0 1 =A0 =A0 1
> =A0 =A0 =A01 =A0 =A0 1 =A0 =A0 1 =A0 =A0 1 =A0 =A0 1 =A0 =A0 1
> =A0 =A0 12 =A0 =A012 =A0 =A012 =A0 =A012 =A0 =A012 =A0 =A012
> =A0 =A0 =A01 =A0 =A0 1 =A0 =A0 1 =A0 =A0 1 =A0 =A0 1 =A0 =A0 1
> =A0 =A0 =A01 =A0 =A0 1 =A0 =A0 1 =A0 =A0 1 =A0 =A0 1 =A0 =A0 1
>
> i want to identify the row that has [12 12 12 12 12 12]
>
> Thanks

data =3D ones(5, 6);
data(3,:)  =3D 12
find(all(data'=3D=3D12))

data =3D

     1     1     1     1     1     1
     1     1     1     1     1     1
    12    12    12    12    12    12
     1     1     1     1     1     1
     1     1     1     1     1     1


ans =3D

     3