Forums > MaxMSP

Remembering most frequently appearing numbers in certain elements of lists

March 23, 2011 | 11:49 am

Hi,

what would be an easy way to report most frequent elements of many lists?

imagine

10 2 5
1 3 5
10 3 2

i want the answer

10 3 5

SO each element of a list would be checked for how frequently a certain number appears.

Thanks.



Ch
March 23, 2011 | 12:38 pm

Hi,

>> i want the answer 10 3 5

Why not 10 3 5 2 ?

Here is one way to do it

– Pasted Max Patch, click to expand. –

March 23, 2011 | 3:28 pm

Thanks, it’s a good solution, but I wanted to keep the length of the list, in my case 20. So I found a way by putting the following in the poly~ object with 20 instances and then packing the outputs:

– Pasted Max Patch, click to expand. –

March 23, 2011 | 3:31 pm

where jb.mode reports the most frequent number here.


Viewing 4 posts - 1 through 4 (of 4 total)