tags:

views:

58

answers:

1

Hi,

Given the cell with string values I would like to count how many different values are stored in it. The following ae the example values:

A(1, 1) = 'DA4590162D037A78D96557AA886ADF9715B79C75';
A(2, 1) = 'AFAB19476C2CEEEE101FFA45FD207BA8B6185B29';
A(3, 1) = '99C1F96461BC870574D002034F001BA3F96A9AB5';
...
A(8, 1) = '99C1F96461BC870574D002034F001BA3F96A9AB5';
A(9, 1) = '4B7F0F39C1192D12E6C798143981048D01CDDDD3';
...

There are approximately 3M rows. Does anyone know the way to calculate how many unique values are stored in the structure?

Thank You!

+3  A: 
B = UNIQUE(A) for the array A returns the same values as in A but
with no repetitions. B will also be sorted. A can be a cell array of
strings.

So

U = unique(A, 'rows'); %because each string is one row
numUnique = length(U)
Marc

related questions