Avg or sum all in a COLL

chrisdavidhowe's icon

so I have a Coll set up to take in indexs up to 50 and then delete index 1, move all indexes down, and add to 50 essentially giving me a constantly changing 50 indexed list. This is for a computer vision project and I am looking to smooth out the blob x/y coord so this was a way I thought to implement it. Basically is there an efficient way to sum all values in a coll and bang that to the output? Is Coll the right tool to be using here?
Thanks

Christopher Dobrian's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I don't know that taking the average of the last 50 values is the best formula for a smoothing filter :), but if you do want to do that, the table object might be your best bet.

Peter McCulloch's icon

Alternatively, use zl.stream 50 to create a running list.

Vexpr does math on lists if you need anything fancy, though you can calculate the mean with the mean object, or the median with zl.median.

Wetterberg's icon

yeah, [zl stream 50], [zl sum], [zl median].