From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to average data collected in a loop

Hey everyone,

I am using an interface card to read voltage across a resistor to measure the current through a photodiode.  The VI I made slowly increases the voltage applied across the sample. It takes a starting voltage, increases it by a specified increment, and then takes a series of measurements at that voltage (usually around 200 or 300). I had the program just save all of this data to an external measurement file, where I would then average it in excel.  I had to change the program to measure three variables, and I want to the VI to average the data and then save the average current at each voltage in a measurement file. 

Ex. 

It used to export the data as...

-1     .90

-1     .80

-1     .85

 

Im trying to get the program to average all of these values and then save it as one data point.

-1     .85

 

I would like the program to take the 200 or so data points, average them, and then save just the average in a file. 

I usually have about 300 different applied voltages to measure, and with 200 current readings at each it becomes a huge amount of data.

 

Right now I have the part of the VI that takes the measurements in a while loop, and once the number of loop iterations reaches the specified number of measurements it stops running.  The program would then increase the voltage, and run the measurement loop again.  I got everything else working, I just can't figure out a way to average all the data.

 

Any help would be greatly appreciated

0 Kudos
Message 1 of 4
(3,341 Views)

On the Functions palette:  Mathematics > Probability & Statistics > Mean.vi

 

This will take an array and return the mean value (average).

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 2 of 4
(3,328 Views)

And accumulate the values with a shift register.

 

A shift register/feedback node is pretty basic LabVIEW knowledge. Have you seen LabVIEW 101?

0 Kudos
Message 3 of 4
(3,318 Views)

Alright, I just started using labview last week and i knew that i would have to use shift registers, but when i tried to create one the add shift register option was grayed out.  All i had to do was click on the right or left side of the loop instead of the bottom which is what i had been trying before. 

Thanks for the fast response

0 Kudos
Message 4 of 4
(3,304 Views)