02-26-2011 06:00 PM
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.
Solved! Go to Solution.
02-26-2011 07:56 PM
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
02-26-2011 11:11 PM
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.
02-27-2011 12:45 PM
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