Finding a vector as a subset of an array
Mostrar comentarios más antiguos
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 comentario
Bruno Luong
el 15 de Dic. de 2018
so in the above example the result should be FALSE right?
Respuesta aceptada
Más respuestas (1)
madhan ravi
el 15 de Dic. de 2018
Editada: madhan ravi
el 15 de Dic. de 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
1 comentario
Prasanna Venkatesh
el 16 de Dic. de 2018
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!