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 ExchangeMatrix 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