Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Get line index on matrix
Date: Thu, 5 Nov 2009 12:12:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 40
Message-ID: <hcufeh$298$1@fred.mathworks.com>
References: <hcudtq$phk$1@fred.mathworks.com> <hcuetm$6t$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257423121 2344 172.30.248.35 (5 Nov 2009 12:12:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 5 Nov 2009 12:12:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2076570
Xref: news.mathworks.com comp.soft-sys.matlab:582691


"Wayne King" <wmkingty@gmail.com> wrote in message <hcuetm$6t$1@fred.mathworks.com>...
> "Joe Nunes" <vazdepaivanunes@gmail.com> wrote in message <hcudtq$phk$1@fred.mathworks.com>...
> > Hello,
> > 
> > I'm trying to get the line index of a nx3 matrix for a given vector (1x3), like
> > 
> > 0.1  0.3  1.6
> > 0.2  0.7  1.2
> > 1.3  0.1  7.3
> > (...)
> > 
> > searching for vector = 0.2 0.7 1.2 should return index = 2.
> > 
> > i've tried find() and a script which compares
> > 
> >     if(vector(i,:) == points(i,:))
> >         index = i;
> > 
> > inside a for() loop (but it says that the condition is not valid, on debug)
> > 
> > I would appreciate your help.
> > 
> > Best regards
> 
> Hi Joe, will the following work for you?
> 
> A=[0.1 0.3 1.6
> 0.2 0.7 1.2
> 1.3 0.1 7.3];
> B= [0.2 0.7 1.2];
> [C,IA] = intersect(A,B,'rows');
> % IA is equal to 2
> IA
> 
> Wayne

Yes, i've tried, but IA returns an Empty matrix: 0-by-1 .. Since my set of points is 1312x3 and the points to find are in 17x3, i've tried 
[C,IA] = intersect(points,keypoints(2,:),'rows')

but it keeps returning empty matrix. Is this because of rounding or something ? i don't understand. This points from 17x3 matrix were taken from the original set.