フィルターのクリア

How to get the index from a matirx

4 ビュー (過去 30 日間)
M@lik Ali
M@lik Ali 2013 年 3 月 31 日
Hi all
i have two matrix A and B, the size of A is like 10 86 and size of B is 3 86.
actually the matrix B is inside the matrix A.
now what i want is to know the index from matrix A where the vectors of matrix B exist.
like we have a row 1,2,3... 86 in matrix B and same in matrix A as well. I want to get the index of A where this row exist in A. please help me.

採用された回答

Wayne King
Wayne King 2013 年 3 月 31 日
A = randn(10,10);
B = A(3:6,:);
[C,IA,IB] = intersect(A,B,'rows','stable');
IA gives you the row indices in A where B is
  1 件のコメント
M@lik Ali
M@lik Ali 2013 年 3 月 31 日
Thanks,

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by