I have a matrix, whose first column contains user IDs, and the second column contains 1s and 0s. I need to find out the top 10 user IDs with the most number of 1s. That is, if the input matrix is the following,
27 0
36 0
36 1
36 0
36 0
27 0
27 0
36 1
27 0
27 0
27 0
27 0
27 1
36 0
I want the output to be the following:
36 2
27 1
That is, even though 27 occurs 8 times and 36 occurs only 6 times, 36 should come on top of 27 because it has more number of 1 values in the original matrix. How do I do this without using a for loop, because for loop takes a lot of time, and the matrix is actually a pretty big one, with lots of unique user IDs.
matlabtag when posting the question. - Kristada67336has the value12 times,27has the value11 time. - Kristada673