Next Steps - LabVIEW RIO Evaluation Kit

cancel
Showing results for 
Search instead for 
Did you mean: 

Using timestamp to name files

I am doing continuous data acquisition for potentially hours on end. I am currently set up so that every time I click my "data record" button, a new file is created and written into. I have incorporated a timestamp as part of this file name, but it continuously updates with the computer clock, so a new file is created every second. How do I just grab the timestamp when I click "data record", and not have it continuously update? Attached is a snapshot of my code.

0 Kudos
Message 1 of 5
(10,900 Views)

Hey Mgonzo,

The behavior you're describing is happening because the string with the timestamp is changing every second. So when the "Write to Spreadsheet File" VI receives the new value (incremented by a second), it checks to see if that file exists, then creates it if it doesn't.

What you want to do is capture the timestamp of when you click the button and keep passing that value to the "Write to Spreadsheet File" VI.  Does that make since?

This isn't a very elegant way of solving the problem, but it should work for you.  If you go to the LabVIEW forums, you should be able to get some more help from there.  Please see the attached screenshots...

Capture 1.PNG

Capture 2.PNG

Capture 3.PNG

If you are not familiar with shift registers here are a couple pages that could help...

http://www.ni.com/video/3235/en/

https://decibel.ni.com/content/docs/DOC-6264

Good luck!

Jeff S

Jeff S.
National Instruments
0 Kudos
Message 2 of 5
(8,418 Views)

Hi Jeff.St,

Thanks for your reply. I actually solved it a different way. My method was to place the routine that updates the filename with the current timestamp in the false case of my case structure, storing the name to a shared variable. Then, when I change my boolean to true, it reads the shared variable, which has the up to date filename.

Thanks.

0 Kudos
Message 3 of 5
(8,418 Views)

Glad to hear you got it working!

Just to let you know, I think you'll typically receive a faster response for questions like this in the LabVIEW forums.

Good luck with the rest of your application!

Best,

Jeff

Jeff S.
National Instruments
0 Kudos
Message 4 of 5
(8,418 Views)

I've also encounter the same problem and haven't been able successfully utilize your solution. Do you mind to share your vi ?

0 Kudos
Message 5 of 5
(6,061 Views)