LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Averaging Data versus Excel Averaging .lvm file data

Solved!
Go to solution

I am trying to build a .VI to measure voltages on one channel from a pressure transducer over a 3 minute time period.  I would like the .VI to write all the voltage samples to an .lvm file along with another .lvm file that just has the average voltage over the 3 minute period.  I have built a .VI that does all the above so I think... The problem I am running into is when I open the .lvm file of all the voltage samples in MS Excel and take the average of them using Excel's built-in average function (=AVERAGE(B23:B5022) for example) and compare it to the .lvm file that just has the 3 minute voltage average from .VI, they don't match up.  

 

This makes me wonder if I am using VI's averaging function correctly or if maybe VI averages different voltage data than what is written to the .lvm file.

 

Does anyone know why the two averages are different and how I can make them match up.  

 

I attached a picture of my block diagram along with the the .VI file for clarity.

Download All
0 Kudos
Message 1 of 4
(2,622 Views)

You need to right-click on the data terminal on the right side of your while loop and select "enable auto-indexing".  Currently the wire coming out of your loop only contains the data collected from the last iteration, NOT from every iteration.  Enabling the auto-indexing will produce an array of data, one element for each iteration.  After averaging all the data in that array things should match up.


Dan

0 Kudos
Message 2 of 4
(2,607 Views)

I enabled the indexing on the For Loop tunnel as you suggested.  The result seems to be the same as before (although I am using the Mean function for 1D arrays as opposed the the Statistical function for dynamic data as before)...as in the averages are still different and do not match up.

 

Attached is the changed .vi along with a screenshot.

Download All
0 Kudos
Message 3 of 4
(2,598 Views)
Solution
Accepted by topic author dividebyzero

The LabVIEW Dynamic Data Type you are using is a special data type that can take many different forms.  It therefore requires using the "From DDT" and "To DDT" to conbert to/from other data types.  These special conversion functions can be configured by double-clicking on them and specifiying the format you are converting from/to.  You cna find the functions on the Express-Signal Manipulation palette.

 

I have attached a screenshot of the modified code using the "From DDT" and the averaging comes out fine.

 

Please mark this solution as accepted and/or give Kudos if this works out for you.  We appreciate the ratings for our responses.

 

Thanks

Dan

Message 4 of 4
(2,577 Views)