Calculating mean from one source

Hi, I’d like to know if it’s possible to calculate the mean of some data continously outputting.

for example, a IOBox is outputting:
1
then
2
then
3
so the mean so far is: 1+2+3 / 3 = 6/3 = 2

the next number is 4
so the mean of the last three numbers is:
2 + 3 + 4 / 3 = 9/3 = 3

the next number lets say is 2
so the mean of the last three numbers is:
3 + 4 + 2 / 3 = 9/3 = 3

is there any way to do this?

thanks

have a look at the attached patch!

mean.v4p (6.7 kB)

Sure you can, you have to use the Queue (spreads) node for this.

I attached a patch for you, to see how I have done it.

Oh, and please register and Log in, so I know who anonymous is ;)

edit: other anonymous beat me to it hehe… at least we both had the same answer, so mine can’t be that bad ;)

Queue and mean.v4p (7.5 kB)

Hi, thanks both, that’s exactly what I was thinking, thanks a lot!

I’m now registered so billgateswill be seen more around here :P

(don’t ask me why, that’s the first login name that came to my mind)