ZL.median with refresh every hour

Qbrick's icon

Hello,

I'm starting a project, but I got 'stuck' on the following. It's a project with data reading from sensors.
Now I want the median number of the list of data that's coming in and I want the list refreshed about every 15 minutes or so to not clog up the cpu. (there will be many sensors in the future attached and doing the same thing & lots of other things running at the same time).

I think I now have a working example that does the trick, being giving me the median of a range of number (drunk is the emulation of the data), what I miss is resetting the data in the list. I don't know how to do that.

example:

Max Patch
Copy patch and select New From Clipboard in Max.

mzed's icon

Maybe like this:

Max Patch
Copy patch and select New From Clipboard in Max.

NB: I put "" in the message box. You can't see it, but it seems to work.

Qbrick's icon

Hi!

Thanks for your response, I've looked at everything to know what it all does so I can comprehend it.

First the list doesn't get cleared after a while, I now have an huge list of all my stored numbers.
So I thought I must do something wrong. metro 60000 is the time it should bang the the time of date object, simple. I've changed that to 1000 to see a faster result.
But then I realised after looking into the date object that the minutes are not equal to the current minutes of my OS, though the date is.
Then I lost it a bit with the % 15 .
Following is the change object which should give me a stored value and then trigger the set with message "" which would then clear the list.
So that would give me what I want, only I doesn't.

mzed's icon

I discovered this bug with the date object, too. I reported to Cycling.

% is the modulo operator. In this case it takes the input, divides by 15, and gives you the remainder. So:
0 % 15 = 0
15 % 15 = 0;
16 % 15 = 1;
17 % 15 = 2;
etc....

Change filters out repetitions. Your use case didn't want a bang on every zero, just the first one.

You'll need to manually type "" into the message box. It works for me when I do that, but not when I copy the patch from the forum.

Qbrick's icon

Yep, it worked and know I get the modulo operator concept!

Indeed this is a bug that happens when it gets copied.

Thanks!