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

조회 수: 7 (최근 30일)
ha ha
ha ha 2017년 8월 19일
답변: Ryan Klots 2017년 8월 19일
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,

채택된 답변

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 線形代数에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!