From: Antonio Baran on
I need find a vector in matrix
ex:
x =

9 8 9 9 3
6 5 6 3 1
8 7 8 2 3
d =

9
6
8

r=find(x==d)
??? Error using ==> eq
Matrix dimensions must agree.

vector d is present in col 1 and 3 of matrix x, i need find position of vector d in matrix x
Thanks
From: dpb on
Antonio Baran wrote:
> I need find a vector in matrix
> ex:
> x =
>
> 9 8 9 9 3
> 6 5 6 3 1
> 8 7 8 2 3
> d =
>
> 9
> 6
> 8
>
> r=find(x==d)
> ??? Error using ==> eq
> Matrix dimensions must agree.
>
> vector d is present in col 1 and 3 of matrix x, i need find position of
> vector d in matrix x
> Thanks

> ismember(x',d','rows')
ans =
1
0
1
0
0
>>

--
From: dpb on
dpb wrote:
> Antonio Baran wrote:
>> I need find a vector in matrix
>> ex:
>> x =
>>
>> 9 8 9 9 3
>> 6 5 6 3 1
>> 8 7 8 2 3
>> d =
>>
>> 9
>> 6
>> 8
>>
>> r=find(x==d)
>> ??? Error using ==> eq
>> Matrix dimensions must agree.
>>
>> vector d is present in col 1 and 3 of matrix x, i need find position
>> of vector d in matrix x
>> Thanks
>
> > ismember(x',d','rows')
> ans =
> 1
> 0
> 1
> 0
> 0
> >>

or, alternatively, w/o the transpose to use the 'rows' option...
>> all(ismember(x,d))
ans =
1 0 1 0 0
>>

--



From: Wayne King on
"Antonio Baran" <juniorbaran(a)gmail.com> wrote in message <ht0suq$bie$1(a)fred.mathworks.com>...
> I need find a vector in matrix
> ex:
> x =
>
> 9 8 9 9 3
> 6 5 6 3 1
> 8 7 8 2 3
> d =
>
> 9
> 6
> 8
>
> r=find(x==d)
> ??? Error using ==> eq
> Matrix dimensions must agree.
>
> vector d is present in col 1 and 3 of matrix x, i need find position of vector d in matrix x
> Thanks

x =[

9 8 9 9 3
6 5 6 3 1
8 7 8 2 3];

d = [
9
6
8];

[C,IA,IB] = intersect(x',d','rows');

d is in the IA-th column of x.

Hope that helps,
Wayne