07-15-2016 11:10 AM
Hello,
I am writing a script that uses a DAQmx function to take in voltage data, then writes the data to a TDMS file. I have a running elapsed time header as well. I would like to write an additional channel keeping the running time for each sample, but do not know how. Can someone help me?
Thanks,
Mmoon
Solved! Go to Solution.
07-15-2016 12:52 PM
07-15-2016 01:17 PM
The thing is that the elsapsed time will just be the sample rate multiplied by the sample number (with the first sample being Sample 0). So you could just use the Ramp Pattern(under Signal Processing->Signal Generation) to create the array of times for you and then you just write that to a new channel in the group. So the only two things you need to know is the sample rate (available via a DAQmx Timing property node) and the number of samples logged (I know there is a TDMS property you can read to get this, I just don't remember what it is right now).
07-15-2016 01:40 PM - edited 07-15-2016 01:41 PM
Get Waveform Time Array might help too. You can read your channel as a waveform, then use this function which will return an array of times, one for each sample taken. It's essentially what crossrulz described but in a single already written function.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-15-2016 01:59 PM
Ok now my issue is that this is creating a new channel with a group for time values, not appending a new group in the already established DAQmx channel. How can I fix this/am I implementing my code correctly?
07-15-2016 08:04 PM - edited 07-15-2016 08:04 PM
You are not even writing to a TDMS file. You need to write to the TDMS file after the acquisition is complete. All of the information is available to add your time channel.
07-18-2016 11:53 AM
Unfortunately I am having trouble with the DAQmx timing node, it won't give me an option to use SampClk.Rate and I do not know why.
07-18-2016 12:01 PM
I figured out my issue. Thank you for all of your help!
07-18-2016 12:42 PM
Actually now I am confused, my timing node only takes in 1000 values for time going to 1.00 seconds, how do I edit this to run continuously?
07-18-2016 12:53 PM
There is an input to the DAQmx Timing VI for the acquisition type (on the top of the VI). Set that from Finite Samples to Coninuous.