find matching indexes

I have two matrices:
A: x rows and 5 columns
B: x rows and 6 columns (the first column contains indexes)
The values of the matrix A are included in the matrix B. I would like to find the indexes of the matrix A (one row)

댓글 수: 2

Doug Hull
Doug Hull 2011년 12월 2일
Huh? Please edit the question for clarity.
Chandra Kurniawan
Chandra Kurniawan 2011년 12월 2일
'(the first column contains indexes)' for matrix B or both??

댓글을 달려면 로그인하십시오.

 채택된 답변

karan
karan 2011년 12월 2일

1 개 추천

Index_find = find(ismember(A,B));

댓글 수: 1

Daniel Shub
Daniel Shub 2011년 12월 2일
Wow, apparently I guessed wrong about the question. Good work Karan.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Daniel Shub
Daniel Shub 2011년 12월 2일

0 개 추천

I think you want something like
[x, ia, ib] = intersect(A, B(:, 2:end), 'rows');
B(1, ib)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2011년 12월 2일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by