Find missing elements from table

조회 수: 14 (최근 30일)
DIMITRA GIANNOPOULOU
DIMITRA GIANNOPOULOU 2018년 6월 3일
답변: Jan 2018년 6월 3일
Hi everybody,
I have a vector A = [1 ;2;3;4;5;6;7;8] and a Matrix B=[1 2; 1 8 ; 2 8] and I want to find the missing elements of A from B. How can I solve this?
  댓글 수: 2
Ameer Hamza
Ameer Hamza 2018년 6월 3일
Which elements of A are missing? Give a proper example that which elements and how do you want to fill it from B.
DIMITRA GIANNOPOULOU
DIMITRA GIANNOPOULOU 2018년 6월 3일
Hi, I want to exclude from A matrix the elements [3 4 5 6 7] which are the elements that are not contained in the B matrix.

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2018년 6월 3일
A = [1;2;3;4;5;6;7;8]
B = [1 2; 1 8 ; 2 8]
C = intersect(A, B)
Or if you want to keep repeated values:
C = A(ismember(A, B))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by