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

Feb 3, 2011 at 2:55pm

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

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

#54772
Feb 3, 2011 at 2:56pm

please see attatched patch of what im working on

#197206
Feb 3, 2011 at 3:35pm

Here is one way, quick & dirty:

– Pasted Max Patch, click to expand. –
#197207
Feb 3, 2011 at 3:42pm

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

#197208
Feb 3, 2011 at 3:46pm

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

#197209
Feb 3, 2011 at 4:01pm

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.

#197210
Feb 3, 2011 at 4:03pm

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

#197211
Feb 3, 2011 at 4:46pm

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

– Pasted Max Patch, click to expand. –
#197212
Feb 4, 2011 at 1:01pm

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!

#197213

You must be logged in to reply to this topic.