Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: array compare to matrix
Date: Wed, 9 Jun 2010 19:55:24 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <huorjb$63q$1@fred.mathworks.com>
References: <huoo0v$9ib$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1276113324 6266 172.30.248.38 (9 Jun 2010 19:55:24 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 9 Jun 2010 19:55:24 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:643568

"what ever" <vasco_taveira@hotmail.com> wrote in message <huoo0v$9ib$1@fred.mathworks.com>...
> Hello people!
> 
> I have a problem i can't fix!
> 
> Imagine that i have a array A=[1,2,3,4,5,6]
> 
> and a matrix M=[1  6 8 44 7 4]
>                       [53 8 3 7  2 8]
>                       [1  2  3 4  5 6]
>                       [3  5  7 7  3 7]
>                       [1  2  3 4  5 6]
> 
> I want a final array that give me the position where A and M are the same, in this case the final array should be:
> 
> FinalArray=[3 4]
> 
> Thanks!!!
> 
> And imagine that the last array of M was [1 2.0004  3 4 5.0003 6.0006]
> 
> what i should do so that the result also include this one?

  To allow a "tol" amount of differece between A and the row of M:

 p = find(all(abs(M-repmat(A,size(M,1),1))<tol,2)); % Finalarray

Roger Stafford