Lookout

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic average

I am trying to average a maximum of 20 expressions (just the current values not over time or anything). But if any of the 20 values are zero I don't included any points in the computation of the average from that point on (ex. if element 9 = 0 then avg 1-8,if element 17 = 0 then avg 1-16. Is there any way of doing this besides using a huge if statement with all the combinations of elements being zero or not (ie... if (element6 = 0, avg(e1,e2,e3...e5),if (element5 = 0,avg(e1,e2,e3,e4)... thanks
0 Kudos
Message 1 of 2
(3,023 Views)
A picture is worth 1000 words....

I use a datatable like one uses an Excel spreadsheet if I need to do iterative calculations. Attached is a Lookout 4.5.1 Build 18 process. If you have a lower version of Lookout you can try to compile the script (lks) file. You may need to do some minor modifications to the lks file.

I used only 10 not 20. But this can be repeated out to 10,000 inputs using a datatable. Also, if you need to repeat a connection over and over it is best and quickest to use a text editor and edit in the script and not use the Lookout GUI.

Regards,
Tommy Scharmann
Download All
Message 2 of 2
(3,023 Views)