MATLAB: How to compare two different cell arrays

MATLABstrings

I would like to know if there is any way by which I can compare all the elements and remove the matched elements if not needed.
eg : a = the, he, hate
b = he, hate
so c should be equal to the.
PS: I have tried string comparision method but, unfortunately they eliminate the 'he' from 'the' thus giving the output as only 't'.
Thank you, vish

Best Answer

The SETDIFF function does what you want. It will give you the values in one set (i.e. cell array) that are not present in another set:
>> a = {'the', 'he', 'hate'};
>> b = {'he', 'hate'};
>> c = setdiff(a,b)
c =
'the'