LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write averaged data to measurement file

Solved!
Go to solution

I'm going crazy over here... I've been trying to figure out how to save to an excel (or text) file data from two DAQ tasks that use DAQ Assistant. They both read 100 data points at 1000 Hz, and they're in a loop that executes every 200 ms. What I would like is two columns of data, with each row containing the mean of the 100 data points collected on each iteration. I've tried various combinations of Write to Measurement File and Write Delimited Spreadsheet with converting back and forth between arrays and signals, and I get either one pair of data points after ten or so seconds of data collection, or a single column of data.

 

The attached VI gives the latter of the two results - I assume the mean values from each task written sequentially in the same column... I would transpose the array before writing but there doesn't seem to be a way to transpose a 1D array...

 

Previously, when I was using "Write Delimited Spreadsheet", I was getting only one or two rows of data no matter how long I let the application run. The only way I could get more than one row of data was if I put a stop sign on the "Write Delimited Spreadsheet" vi, presumably because that gave it time to do the actual open/write/close operation.

 

I was able to get lots of data if I didn't take the mean, but I don't need all that data - I just want to record the mean value over the 100 data points that are collected every 200 ms. At this point, I won't have any hair left by the time I figure it out...

0 Kudos
Message 1 of 4
(1,734 Views)
Solution
Accepted by topic author jfalesi

@jfalesi wrote:

IThey both read 100 data points at 1000 Hz, and they're in a loop that executes every 200 ms. What I would like is two columns of data, with each row containing the mean of the 100 data points collected on each iteration. I've tried various combinations of Write to Measurement File and Write Delimited Spreadsheet with converting back and forth between arrays and signals, and I get either one pair of data points after ten or so seconds of data collection, or a single column of data.

 

presumably because that gave it time to do the actual open/write/close operation.

 

I was able to get lots of data if I didn't take the mean, but I don't need all that data - I just want to record the mean value over the 100 data points that are collected every 200 ms. At this point, I won't have any hair left by the time I figure it out...


I can't look at your code for a few reasons but it you are not using a Producer/Consumer architecture, you should be.

 

The Producer loop will do all the data acquisition and put the data in a queue. (a buffer)

The Consumer loop can take it's own sweet time to dequeue, process, and save the data without effecting the data acquisition.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 4
(1,700 Views)

I did the following example some time ago, and perhaps you can edit the consumer loop to compute the mean of your measurements: TDMS Data Logging From Multiple DAQmx Tasks in LabVIEW

 

I hope it can provide some guidance on how something like this could look like.

 

All the best,

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

Thanks, I wised up and used a P/C pattern with channel wires.

0 Kudos
Message 4 of 4
(1,625 Views)