Octave: Check if cell array of strings contains string
If you have a cell array of strings in Octave like this:
arr = {"a", "bc", "def"}
you can check if it contains a specific string like "a"
using
contains_a = any(strcmp(arr, 'a'))
Example:
arr = {"a", "bc", "def"}
contains_a = any(strcmp(arr, 'a'))
contains_x = any(strcmp(arr, 'x'))
disp(contains_a) # 1
disp(contains_x) # 0