05-18-2018 10:55 AM - edited 05-18-2018 10:57 AM
Hi all,
I'm trying to write data to a spreadsheet with column headers and a timestamp column without using Write to Measurement File.vi I am able to do all of this, except label the column headers with the WMF express .vi, the problem i have with express anything is that you really don't know how any of it works.
Do any of you have an example or example code you could share? I basically have (4) AI channels of data to save with a timestamp.
Solved! Go to Solution.
05-18-2018 01:10 PM - edited 05-18-2018 01:15 PM
In general here is what I do, instead of using any of the "prefab" vi's I use the low level file vi's that pass a REFERENCE once you open the file instead of a file path. This has the advantage of automatically locking the file so if you try to open it while LabVIEW has it locked it will inform you and give you the option to open a copy or open the file read only. This prevents your LabVIEW program from crashing with a sharing violation because you have the file open in another program when LabVIEW tried to write to it.
Your column headers have to be applied separately since they are text and your measurements are numerics. I usually write the headers at the same time I open the file.
Then when I write my numeric data to the file I use this handy VI I created a long time ago that puts a time stamp on the data and writes it to the file.
This VI will generate it's own timestamp if you do not wire one into it.
Don't forget to close the file reference when you exit your program
05-19-2018 04:33 AM
Oh, great, another Timestamp Definition! OLE, LabVIEW, Excel. No wonder Timestamps are such a Pain Where You Sit. Sigh.
Bob Schor
05-20-2018 11:09 PM
@Bob_Schor wrote:
Oh, great, another Timestamp Definition! OLE, LabVIEW, Excel. No wonder Timestamps are such a Pain Where You Sit. Sigh.
Bob Schor
I found that definition here after all...
Anyway modern versions of Excel may not need this, but I have found it very handy anyway as in cases where you have irregular data intervals or gaps in the data. It is easy to do the math on the timestamps to get elapsed time,
05-21-2018 01:13 PM
i've been investigating this further and found that TDMS file generation is pretty easy, there is really only one function that the Save to measruement file express vi does that i haven't figured out yet and that is how to assign the timestamp to a column in the tdms file. It's there i can see it from the probe, i have both time and dt, which i'd like to be columns (1) and (2) in the final file.
I tried just adding another instance of the TDMS write, see below, unortunately this creates a second sheet in the file with the timestamps. I think i'm close i just need a bit of help to get it the rest of the way.
06-29-2018 08:42 AM
Back on this topic... Anyone at all have a solution to get the timestamp data with the measurement data in a single spreadsheet for TDMS?
What i'm doing now is peeling the timestamp from the 1D waveform from DAQmx read and putting it in a separate write to TDMS, which works in terms of capturing it but it shows up in a separate spreadsheet. How can i place it in the spreadsheet with the measured data?
06-29-2018 09:09 AM
@coolhandLV7 wrote:
What i'm doing now is peeling the timestamp from the 1D waveform from DAQmx read and putting it in a separate write to TDMS, which works in terms of capturing it but it shows up in a separate spreadsheet. How can i place it in the spreadsheet with the measured data?
Make sure you are writing to the same group as your data.