LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to new TDMS file each time program runs

Hi! 

We are trying to log data from an accoustic sensor using the open/write/close TDMS blocks. Problem is, we cant get it to write to new files for each measurement, or each time the program runs. For example using a date and time stamp on the filename. 


Is there a simple solution to this? We're kinda new to LabVIEW, so any help would be appreciated! 🙂 

0 Kudos
Message 1 of 11
(3,238 Views)

Hi Superjurg…,

 

create a filename on your own each time your program starts, maybe using FormatDateTimeString and BuildPath!

Wire this filepath to your TDMS save function.

 

That's pretty simple. When you're new to LabVIEW I recommend to take all those FREE online courses offered by NI on their website…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 11
(3,229 Views)

Thanks for the reply! 

We'll try this out right away 🙂 

0 Kudos
Message 3 of 11
(3,209 Views)

We tried making a small VI just to try it out, but we keep getting the <Not a Path> error. I'm not sure what we're missing.. 

Could you, or anyone, take a look? 

0 Kudos
Message 4 of 11
(3,204 Views)

Cannot open LV2014, I'm limited to LV2011 right now…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 11
(3,200 Views)

Can you spot anything from this image? 🙂 

0 Kudos
Message 6 of 11
(3,195 Views)

Hi Super,

 

right now you create a new filename each second…

 

- You should create file name before the loop starts. That way you only deal with the same filename as long as your loop runs.

- I would advise to use a more suitable format for your date/time string. Something like "%y%m%d-%H%M%S.tdms"…

- You should open the TDMS file before the loop starts and close it after the loop has finished. No need to open and close it in each iteration…

- What kind of filepath is generated and wired to TDMSOpen? Did you try to debug that?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 11
(3,187 Views)

Hi again! 

We did what you said, and tinkered for a while and got it working, thanks! 🙂 

Message 8 of 11
(3,170 Views)

Adding to Gerds comment, if you look at the output of the Get Date/Timestring-function, it'll result in 16:32, causing an invalid filename as you cant have colons in the name. You probably also want the seconds active, and you dont need the Get current time, as it's the default for the get date/time string.

Format into string is the solution. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 11
(3,151 Views)

Superjurg,

 

I was wondering with the way you presented your code in your picture that you post why you didn't see an error window pop up on the issue with the file name?  Unless that was a bug for the LV version you are using?

0 Kudos
Message 10 of 11
(3,140 Views)