MATLAB: How to find the common elements of 2 cell arrays of strings

commonelementsfindintersectintersectionMATLAB

I have 2 cell arrays containing strings. I would like to find the elements that are common to both arrays and get their positions. Is there a function to do that?

Best Answer

Use the "intersect" function as follows:
>> [C,ia,ib] = intersect(A,B, 'stable');