Count number of unique values in column one, for each unique value in column 2
Afficher commentaires plus anciens
I've been faced with a problem that is giving me lots of trouble. I need to calculate the number of unique records in one column for each unique record in the second column. For example: If I have
Activities = {'walk', 'monday'; 'walk', 'monday'; 'eat', 'monday'; 'TV', 'tuesday'; 'run','wednesday'; 'eat', 'wednesday';...}
'call', 'Thursday';'work', 'Thursday'; 'call', 'Thursday';'work', 'Thursday';'sleep','Thursday'}
What I'd like in another column is the total number of unique activies for each unique day, formatted like "Result".
Result = [2;2;2;1;2;2;3;3;3;3;3]
1 commentaire
WAT
le 29 Sep 2015
This seems to be a repeat of http://www.mathworks.com/matlabcentral/answers/245839-count-the-number-of-occurrences-of-elements-in-second-column
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Holidays / Seasons dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!