comparing two matrix for similar matrix

9 Ansichten (letzte 30 Tage)
jesus escareno
jesus escareno am 15 Sep. 2017
Kommentiert: jesus escareno am 15 Sep. 2017
So i have matrix A and matrix B and i want to create a matrix C with all the terms that are not alike. What ive tried using is ismember which kinda work.
a = [1 2 3];
b = [1 2 3;
4 5 6;
7 8 9];
i = ismember(b , a);
c = b(~i)
this yields the fallowing result
c = [ 4 ; 7; 5; 8 ; 6 ;9]
but what i need is
c = [4 5 6;
7 8 9]

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 15 Sep. 2017
Bearbeitet: Andrei Bobrov am 15 Sep. 2017
a = [1 2 3];
b = [1 2 3;
4 5 6;
7 8 9];
i = ismember(b , a, 'rows');
c = b(~i,:)

Weitere Antworten (0)

Kategorien

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

Community Treasure Hunt

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

Start Hunting!

Translated by