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 日

0 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeMultidimensional Arrays についてさらに検索

質問済み:

2018 年 6 月 3 日

回答済み:

Jan
2018 年 6 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by