Forums > MaxMSP

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

Feb 03 2011 | 2:55 pm

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


Feb 03 2011 | 2:56 pm

please see attatched patch of what im working on

Feb 03 2011 | 3:35 pm

Here is one way, quick & dirty:

-- Pasted Max Patch, click to expand. --

Feb 03 2011 | 3:42 pm

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

Feb 03 2011 | 3:46 pm

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….

Feb 03 2011 | 4:01 pm

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.

Feb 03 2011 | 4:03 pm

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

Feb 03 2011 | 4:46 pm

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

-- Pasted Max Patch, click to expand. --

Feb 04 2011 | 1:01 pm

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!

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

Forums > MaxMSP