From: what ever on 9 Jun 2010 14:54 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?
From: Walter Roberson on 9 Jun 2010 15:19 what ever wrote: > 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, See the ismember 'rows' option.
From: Roger Stafford on 9 Jun 2010 15:55 "what ever" <vasco_taveira(a)hotmail.com> wrote in message <huoo0v$9ib$1(a)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
From: what ever on 11 Jun 2010 21:01 thanks a lot Walter and Roger!!
|
Pages: 1 Prev: Finding the data based on their index Next: Rank of particular data |