To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example takes the average of the last five values that have been read in every 1 second.
Description
This VI takes the average of the last five values that have been read in. The example reads the value of the control every second and adds that to the previous four values read which are stored in the shift register. It then takes the average of them. It should be noted that using this method the average will only be accurate after 5 seconds because the shift registers are initialized to zero.
One way to avoid the error of the first five samples giving an inaccurate average was suggested in this thread using the In Range Coerce VI.
Requirements
LabVIEW Base Development System 2012 or compatible
Steps to Implement or Execute Code
Additional Information or References
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange. **
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.