EDIT:
gnovice's suggestion is even simpler than mine:
[~,indx]=ismember(X,M,'rows')
indx =
3
FIRST SOLUTION:
You can easily do it using find
and ismember
. Here's an example:
M=magic(4); %#your matrix
M =
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
X=[9 7 6 12]; %#your row vector
find(ismember(M,X),1)
ans =
3
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…