MATLAB: Count the number of occurrences of elements in second column

accumarrayhistunique

Hello, I'd like to know the number of unique entries, per unique entry in second column. For example, how could I return the number of unique activities per day.
Thanks so much for your time and help!
Activities = {'run', 'monday'; 'run', 'monday'; 'eat', 'monday'; 'TV', 'tuesday'; 'run','wednesday'; 'eat', 'wednesday'}
So in this example, I'd like the total number of unique actives, per day. So my desired result would look like "Result".
Result = [2;2;2;1;2;2]

Best Answer

[~,~,a]=unique(Activities(:,2));
b = histc(a,1:a(end));
Result = b(a);