c1={'ESP00021','ESP00023','ESP00023'};
c2={'ESP00023','ESP00025'};
[~,idx] = ismember(c2,c1,'rows');
Question: how many matching rows do you have?
Answer: none.
Both of the cell arrays constitute exactly one row. Those two rows are different (both the contents and number of elements), so there are no matching rows and the output idx would not be a valid index... if it worked at all, which I doubt because ismember is not specified to work with cell array input and the 'rows' option. Neither does it work when I tried it with numeric arrays with a different number of columns:
>> [~,idx] = ismember([1,2,3],[45,45],'rows')
Error using ismember>ismemberlegacy (line 276)
Inputs A and B must be matrices with the same number of columns in the 'rows' case.
The cannot be fixed by simple removing 'rows' because the second char vector in c2, 'ESP00025', does not match any char vector in c1 so the second index value will still be zero (not a valid index).
What are you actually trying to achieve?
Best Answer