Compare two cell array (different sizes) and return 0 or 1

1 visualización (últimos 30 días)
Lucas S
Lucas S el 9 de Mzo. de 2020
Comentada: Lucas S el 9 de Mzo. de 2020
Hello !
I have 2 cells array of string :
  • one which is general with many items like : A = {A, B, C, D, E, F, G, H};
  • and the seconde which is the one i want to compare with the other : B = {C, E, J};
How can i compare B and A and return 1 if all items of B are in A and 0 if not ?
Thans you for helping !

Respuesta aceptada

Adam Danz
Adam Danz el 9 de Mzo. de 2020
Editada: Adam Danz el 9 de Mzo. de 2020
A = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'};
B = {'C', 'E', 'J'};
idx = ismember(B,A);

Más respuestas (0)

Categorías

Más información sobre Language Fundamentals en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by