how to count how many time rows of an matrix apear in other matrix

3 ビュー (過去 30 日間)
Agung Pratama Pujayasa
Agung Pratama Pujayasa 2022 年 6 月 20 日
so i have local matrix
local = [1 1 3;
1 2 7;
1 3 5];
and global matrix
global = [1 1 3;
2 1 4;
1 3 5;
2 4 5];
is there's way i can get the amount of times rows fom local matrix is used in global matrix?in said example it should be 2

採用された回答

KSSV
KSSV 2022 年 6 月 20 日
編集済み: KSSV 2022 年 6 月 20 日
Read about ismember
A = [1 1 3;
1 2 7;
1 3 5];
B = [1 1 3;
2 1 4;
1 3 5;
2 4 5];
[c,ia] = ismember(A,B,'rows')
N = nnz(c)
  1 件のコメント
Agung Pratama Pujayasa
Agung Pratama Pujayasa 2022 年 6 月 21 日
thank you very much, ismember is realy fit what i look for

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by