Path: news.mathworks.com!not-for-mail
From: "hailiang shen" <hlshen2005@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Is there any non loop implement to find the index of a vector  in the matrix?
Date: Sun, 14 Dec 2008 15:05:04 +0000 (UTC)
Organization: Guelph
Lines: 16
Message-ID: <gi37b0$7v9$1@fred.mathworks.com>
References: <gi31mu$sqn$1@fred.mathworks.com>
Reply-To: "hailiang shen" <hlshen2005@gmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1229267104 8169 172.30.248.37 (14 Dec 2008 15:05:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 14 Dec 2008 15:05:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1339183
Xref: news.mathworks.com comp.soft-sys.matlab:506879


you can change the matrix to a 'char', and use 'findstr' function.

For example, 
a=num2str([1, 2]);
b=num2str(reshape([4 5;6 7;8 7;1 2;2 3]', 1, 10);
findstr(b,a)

"zedong 
" <zdongwu@gmail.com> wrote in message <gi31mu$sqn$1@fred.mathworks.com>...
> Is there any non loop implement to find the index of a vector  in the matrix?
> for example:
> a=[1 2]
> b=[4 5;6 7;8 7;1 2;2 3]
> I want to return  4
> (which is the index of a in b)
> Thank you !