Finding a vector as a subset of an array
古いコメントを表示
I have
a = [2 2];
b = [2 3];
How to find that 'b' contains all the elements of 'a' i.e. here two 2's. Here 'b' contains only one '2'.
1 件のコメント
Bruno Luong
2018 年 12 月 15 日
so in the above example the result should be FALSE right?
採用された回答
その他の回答 (1 件)
madhan ravi
2018 年 12 月 15 日
編集済み: madhan ravi
2018 年 12 月 15 日
a = [2 2];
b = [2 3];
idx=ismember(b,a);
all(idx) % if zero then b doesn't contain all the elements of a else vice versa
1 件のコメント
Prasanna Venkatesh
2018 年 12 月 16 日
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!