LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time stamp to name a TDMS file

Hi:

 

 

I am using data from excel files to create a time stamp, after that,my VI creates TDMS files with this data in files with 5000 samples, also I am using time stamp to named the TDMS files, but my problem is that my first file takes the name 180000.000, How can I modify this? because I need my file´s name will be the first data from excel.

 

I attached my VI and two excel files, the idea is that the first file will be 84327.500 and the second will be 84740.950

Download All
0 Kudos
Message 1 of 3
(2,946 Views)

First, let me congratulate you on taking your first steps to learning LabVIEW. If you have not already done it, I highly recommend you go through the online tutorials. You have an actual project to work on, so application of what you learn will be fairly immediate.

 

For your actual program issue, you need to read the data from the Excel file and convert it to a timestamp before you set your filename. The order of operation of your program is to set the TDMS file name while simulataneously reading from the Excel file. After you have already created the TDMS file, you convert the data to a timestamp and write this to your timestamp front panel control. Note that the first point you write to the TDMS file may or may not be what you think it is. It could easily be the same 180000.000 value you are using to name the TDMS file. You have what is known as a race condition. The order of operation between the read and write of the timestamp control is not known and can be variable. It is one of the reasons that you should NEVER use local variables to pass data around. Use wires. In LabVIEW, wires are the data and take the place of variables in a text base language. Front panel controls should be used only for user interace reasons. In your loop, you should wire the timestamp from its current conversion (wired into the timestamp on the front panel) directly to the TDMS write (currently wired from a local variable of timestamp).

 

A couple of other things. You do not need to convert your data arrays to matrices to index them. This can be done directly with Index Array from the array palette. This single primitive will replace the Array Subset, convert to matrix, and index matrix primitives.

 

You do not need to go through a string conversion to produce a timestamp. The Date/Time to Seconds primitive in the timing palette will do it directly. You will need to populate the cluster input.

 

When you posted your code, you did not include your subVIs. In the future, include all your VIs, either separately or in a ZIP file.

 

Finally, to solve your intial problem, use Index Array to pull the first row of data from the Excel file, then convert this to a timestamp using Date/Time to Seconds. Use this to create your TDMS file.

 

You may have noticed, if you do all this, you do not need your timestamp front panel control, other than as a simple monitor.

 

Good luck! Welcome to LabVIEW.

Message 2 of 3
(2,901 Views)

ok, thanks for your help, at this moment I will prove your comments.

 

Later I will write my comments about them.

 

Thanks a lot.

 

And Yes you are right I began to learn about Labview a few months ago, I need more practice to improve my programation processes.

0 Kudos
Message 3 of 3
(2,886 Views)