search smaller string array to bigger string array

1 Ansicht (letzte 30 Tage)
joms
joms am 22 Jan. 2021
Bearbeitet: joms am 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]

Akzeptierte Antwort

Matt J
Matt J am 22 Jan. 2021
Bearbeitet: Matt J am 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 Kommentar
joms
joms am 22 Jan. 2021
Bearbeitet: joms am 22 Jan. 2021
exactly what i wanted . thank you

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Create Block Masks finden Sie in Help Center und File Exchange

Produkte


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by