search smaller string array to bigger string array

조회 수: 1 (최근 30일)
joms
joms 2021년 1월 22일
편집: joms 2021년 1월 22일
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
  댓글 수: 1
joms
joms 2021년 1월 22일
편집: joms 2021년 1월 22일
exactly what i wanted . thank you

댓글을 달려면 로그인하십시오.

추가 답변 (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