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

1 Ansicht (letzte 30 Tage)
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

Akzeptierte Antwort

KSSV
KSSV am 20 Jun. 2022
Bearbeitet: KSSV am 20 Jun. 2022
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)

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by