I'm new to LabVIEW and I'm having some trouble with writing an input voltage from a USB-6009 to a single column in a .tdms file.
I have the DAQ set in continuous mode. My sampling rate is set to 100Hz but it seems that the Samples to Read (50 samples in my case which I arbitrarily chose) writes 50 samples to a sheet in excel. This means that my data is separated on many many Excel sheets. Each sheet represents half a second. I want the voltage to be written as a single column.
How do I get the DAQ to write all the continuous voltage samples to a single column in Excel?
Aplogies if this is quite basic but I can't seem to get past this.
An example of the Excel data is attached and also the VI I have used. The loop on the right is what I am concerned with. The loop on the left works fine.
I'd appreciate any help with this.
Is this what you mean?
There is no reason to use two while loops so i removed one.
Also converted to DAQmx blocks
Thank you very much for this I really appreciate it. It puts the data into an excel row which is great.
However the 'tasks/channels in' and 'samples per channel' on the Sample Clock somewhat confuse me so I'm not sure what values to use.
What values should I use here for a specific sampling frequency i.e 100Hz sampling rate, so that I'll have 100 voltage samples per second?
Thanks a lot,
Setting your sample rate to 100 will cause the device to read at 100 samples per second. That's not your problem here! Your problems are with how many samples you read per iteration and the darn ineffeceint way you save them to file.
With DAQmx streaming to file is really very easy just drop in a DAQmx Configure Logging.vi:
Each read will grab another 50 samples, write them to the TDMS file, and add them to the chart history of "data".
There is a free TDMS add-in for Excel to import the data to your spreadsheet- TDMS has a few additional features that "Write to Spreadsheet file" lacks. You might just find some of them useful.
Averna Automated Test Systems
The only thing I would change from Jeff's example is to not even wire up the Samples to Read on the DAQmx Timing VI. All that does when using Continuous Samples mode is limit your buffer size. So leave it unwired just in case something comes along that slows down your program.