|
How to periodically sample a variable and then get an average value?Hi, How would one go about sampling a value (like from a random patch), every second or so, and then after a certain period of time get an average value from all the sampled values? I'm not good in javascript, but my guess is to create a structure in javascript, and then sum up and divide the sum with the structure count…however how does one sample a value every second? Thanx!
|
Hi, this is the chain I would use:
The output of the "Queue" patch is a structure of your values that you can feed in into a JavaScript patch to do the sum and division by the count of the structure.
Hope that helps!
Achim Breidenbach Boinx Software
Yes, that solved my problem, thanks!
Ivan