I have a data table that expresses how many times a certain thing happens.
0 appears 3 times
1 appears 4 times etc.
The time these numbers appear is related to another column and lasts for a certain amount of time. I was wondering if there is a way I can relate these 2 columns so I can get an output of something similar to this:
0 appears 3 times for 4 seconds
1 appears 4 times for 10 seconds.
The code I am currently using is
[u, ~, uidx] = unique(A(:));
counts = accumarray(uidx, 1);
fprintf('%d appears %d times\n', [u, counts].');