[SIMPLE] How to make matlab find the difference of a set of strings in a 1 column matrix

2 views (last 30 days)
hi
what i mean:
i have a matrix with string(it is a name);
T-NI-UA-kunde1-1
T-NI-UA-kunde1-1
T-NI-UA-kunde1-1
T-NI-UA-kunde1-2
T-NI-UA-kunde1-2
T-NI-UA-kunde1-2
T-NI-UA-kunde2-1
T-NI-UA-kunde2-1
i want matlab to search inside this cell. and find how many different names is there and how many of same names exist.
thanks for help

Answers (1)

dpb
dpb on 10 Apr 2014
>> [u,~,ic]=unique(c);
>> histc(ic,1:length(u))
ans =
3
3
2
>> u
ans =
'T-NI-UA-kunde1-1'
'T-NI-UA-kunde1-2'
'T-NI-UA-kunde2-1'
>>

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!