MATLAB: How to delete duplicate words (ie., two words combine) in cell arrays

cell arrayremove duplicatetext fild

Sir,
My cellarray contain the following words,
C= {'the best', 'work fast', the best', 'come fast', 'forget', 'tension', 'forget', 'come fast')
How to remove the duplicate cells ie., the best, come fast and forget are duplicate cell arrays.
The output file is C1={'the best', 'work fast', 'come fast', 'forget', 'tension'}
How to get this output.
Thanks.

Best Answer

Probably not the fastest way...
function C = dedupeCell(C)
s = repmat(true,length(C),1);
for i = 1:length(C)
for j = 1:i-1
if strcmp(C{i},C{j})
s(i) = false;
end
end
end
C = C(s);
end
Results in:
>> C= {'the best', 'work fast', 'the best', 'come fast', 'forget', 'tension', 'forget', 'come fast'};
>> dedupeCell(C)
ans =
'the best' 'work fast' 'come fast' 'forget' 'tension'
Please take the time to put accurate code in your question (your cell definition is missing a quote, and is closed with a parenthesis).