search smaller string array to bigger string array

1 次查看(过去 30 天)
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]

采纳的回答

Matt J
Matt J 2021-1-22
编辑:Matt J 2021-1-22
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Create Block Masks 的更多信息

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by