I've got two arrays,
a1 = ["a", "b", "c", "d", "e", "f"]
a2 = ["c", "f"]
I would like to check if a2 is present in a1. For a dingle entry, I could use find. I'm not sure how to check for all entries of "a2" at once
Any suggestion on how to check?

 採用された回答

KSSV
KSSV 2020 年 8 月 30 日
編集済み: KSSV 2020 年 8 月 30 日

4 投票

Read about ismember.
[c,ia] = ismember(a1,a2) ;
a1(c)

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Characters and Strings についてさらに検索

製品

リリース

R2019b

質問済み:

2020 年 8 月 30 日

編集済み:

2020 年 8 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by