MATLAB: Removing duplicate strings from an array and original

duplicaterepeatingstringsunique

so i'm having trouble trying to eliminate repetitions from my arrays. i've been using unique but can't have the first instance of the element in the return. I'm also dealing with strings as opposed to numerical arrays. for example:
A = AA,AB,AC,AA,AD,AE; B = unique(A); B = AA,AB,AC,AD,AE
what i'm actually looking for is B = AB,AC,AD,AE where even the first instance of repeating elements is taken out. is this possible?
Thanks

Best Answer

You can use much the same method as in my answer to your last question. Assuming that the strings are in a cell array:
>> A = {'AA','AF','AB','AC','AA','AD','AE'};
>> [~,X,Z] = unique(A,'stable') % remove 'stable' to get sorted output
>> Y = histc(Z,1:numel(X))<2
>> A(X(Y))
ans =
'AF' 'AB' 'AC' 'AD' 'AE'
If the data is all in one string then use strsplit or regexp first.