What key detail have I missed?
The fact that your raw cell array contains both text and numbers.
groceries = {'apple', 'banana', 'chicken', 'milk'};
fruit = {'apple', 'banana'};
ismember(groceries, fruit)
Compare the above with:
groceries = {'apple', 'banana', 'chicken', 'milk', 23.55};
fruit = {'apple', 'banana'};
ismember(groceries, fruit)
Error using cell/ismember (line 34)
Input A of class cell and input B of class cell must be cell arrays of character vectors, unless one is a character vector.
This is a different error message than you would receive if you ran this code in release R2010a or R2010b (we've changed it at least once in the ensuing ten years) but the root cause is the same. If you run the second example you'll see it gives you the same error as you posted.
Best Answer