search smaller string array to bigger string array

1 vue (au cours des 30 derniers jours)
joms
joms le 22 Jan 2021
Modifié(e) : joms le 22 Jan 2021
how can i search 'selected' string array to bigger 'alllistarray' and index as 'mask'
selected={'a', 'gg' 'c'}
Alllist={'a', 'b' ,'d' 'ee' ,'ff' 'gg',}
%%result should be like this
mask=[0 0 1]

Réponse acceptée

Matt J
Matt J le 22 Jan 2021
Modifié(e) : Matt J le 22 Jan 2021
selected={'a', 'gg' 'c'};
Alllist={'a', 'b' ,'d' 'ee' ,'ff' 'gg'};
mask = ~ismember(selected,Alllist)
mask = 1x3 logical array
0 0 1
or
mask = ~contains(selected,Alllist)
mask = 1x3 logical array
0 0 1
  1 commentaire
joms
joms le 22 Jan 2021
Modifié(e) : joms le 22 Jan 2021
exactly what i wanted . thank you

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Create Block Masks dans Help Center et File Exchange

Produits


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by