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!