How to count specific numbers in a list for each time list updates?

Ali's icon

Which object is best suited to count through a list that has only 2 possible numbers.
I need it to tell me how many time the number 0 is present and how many times 255 is present for each update of the list

Im looking through the zl family of objects but getting quite confused

All help greatly appreciated

Ali

Ali's icon

please see attatched patch of what im working on

1762.2DCAManagingthenumbers.maxpat
Max Patch
pdelges's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here is one way, quick & dirty:

Ali's icon

Cheers for your help Patrick, that will do the job nicely

Ali's icon

Although if I place this into my patch how come the bottom number box doesn't update when i run my program (start game)?

The list updates but not the bottom number box.

I'm probably missing something simple....

1763.2DCAManagingthenumbers2.maxpat
Max Patch
pdelges's icon

Connect the output of your jit.spill to "my" small contribution, or insert a t b l between your huge message and jit.spill (the b connected to the message, the l to the prepend set). Or...
BTW, you can use the message's rightmost input instead of using set.

Ali's icon

Ok cheers again I'll get stuck into it, thanks mate

Emmanuel Jourdan's icon
Max Patch
Copy patch and select New From Clipboard in Max.

some alternatives using zl or the jit.3m that you already had in place.

Ali's icon

Thanks Emmanuel, that both gives me nice solution to my problem and answers a question I was about to ask about using zl. Much Appreciated mate!