How to check if a string is an element of a string set?

19 views (last 30 days)
For example the set is {"aaa" "bbb" "ccc"} and I want to check if mystring == "aaa" mystring == "bbb" mystring == "ccc" But in general, I would like to collect and represent the set in a data structure, and make the check as simple as possible.

Answers (1)

Image Analyst
Image Analyst on 29 Jun 2015
The ismember() function is used for this purpose.

Categories

Find more on Variables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!