Pny
Pny

Reputation: 11

How can I find a row equal to a vector in a matrix in matlab ? In, particular I would like to have the indexes

I have a vector A=[1 2 3] and I have a matrix B=[5 6 8,1 2 3, 9 6 5]. How can I find the row indexes? I tried find but it didn't work

Upvotes: 0

Views: 273

Answers (1)

byetisener
byetisener

Reputation: 310

You can use the ismember function for a one-line solution to that question.

The usage will be like this:

[tf, index]=ismember(A,B,'rows');

Upvotes: 2

Related Questions