Finding a vector as a subset of an array
Ältere Kommentare anzeigen
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 Kommentar
Bruno Luong
am 15 Dez. 2018
so in the above example the result should be FALSE right?
Akzeptierte Antwort
Weitere Antworten (1)
madhan ravi
am 15 Dez. 2018
Bearbeitet: madhan ravi
am 15 Dez. 2018
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
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!