Example Code

Mean of Arrays

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview: This example demonstrates how you could average arrays as they are generated in a VI.


Description

This example demonstrates how you could average arrays as they are generated in a VI. This is similar to the Mean Pt. by Pt. VI which averages values as they are generated to a specific sample length, except this averages arrays generated/acquired to a specific number of arrays. For example, if the arrays generated for the first 3 iterations of the loop are [a1, b1, c1], [a2, b2, c2], [a3, b3, c3], and the length (number of arrays to average) chosen is 3, the reported average would be [(mean of a1, a2,a3) ; (mean of b1,b2,b3) ; (mean of c1,c2,c3)]. As there is currently no primitive function to do this, it could be very valuable for applications where the arrays themselves need to be averaged and not just the elements in an array.


 

Requirements: LabVIEW 2012 (or compatible), Hardware: none.


Steps to Implement or Execute Code:

1. Run the VI.
2. Arrays Generated increases.
3. Mean Array is recalculated.


Additional Information or References: 

 

Mean of Arrays FP.png

 

Mean of Arrays sn.png


**This document has been updated to meet the current required format for the NI Code Exchange.**  

Vivek Nath
National Instruments
Applications Engineer

Machine Vision

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Andy_C.
NI Employee (retired)
on

I couldnt seem to find any attachments...

Andy Chang
National Instruments
LabVIEW Control Design and Simulation
Todd S.
NI Employee (retired)
on

also, could you please add a screen shot of the code once you attach it.

Todd S.
LabVIEW Community Manager
National Instruments
Vivek_N
NI Employee (retired)
on

Attached!

Vivek Nath
National Instruments
Applications Engineer

Machine Vision