How to find the Union of two matrices with the same column size?

9 visualizzazioni (ultimi 30 giorni)
I have two matrices of different sizes: say A(n,2) and B(m,2). How to find the "Union" or "Intersection" of these two matrices?
*Hope the result will be: C(k,2)= A ⋃ B .....and D(p,2) =A ∩ B
**Thanks so much,

Risposta accettata

Ryan Klots
Ryan Klots il 19 Ago 2017
It looks like the union and intersect functions might come in handy here.
Try
C = union(A, B, 'rows');
D = intersect(A, B, 'rows');

Più risposte (0)

Categorie

Scopri di più su 線形代数 in Help Center e File Exchange

Tag

Non è stata ancora inserito alcun tag.

Community Treasure Hunt

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

Start Hunting!