MATLAB: How to count the number of different strings in a string list

MATLABvector

Dear All
I would need some help on this:
I have the following string list:
AAA
ABB
CDE
ABB
CCR
AAA
FDR
I would need to count the different strings in this list which is, in this example 5, and this would be my output.
The acual list may have undreds of strings.
Many thanks in advance!
Para

Best Answer

Hi, use
str = {'AAA','ABB','CDE','ABB','CCR','AAA','FDR'};
numstr = numel(unique(str))