From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Beginner question: how do I get my program to write to another file after so many loops?

Solved!
Go to solution

Im trying to get my program to write to a different file after 65,535 loops. Firstly can I create a file to start with, so operator will not be needed for the switch over? Secondly how do I get it to change from one file path to another, some kind do while satement? I have attached my program, I am also not entirely sure what the two current file paths are used for, is it one to call the file and one to save?

 

Cheers 

0 Kudos
Message 1 of 8
(3,030 Views)
Use a loop count (i in while loop) check for your condition and use a write to spread sheet function.
0 Kudos
Message 2 of 8
(3,026 Views)
Solution
Accepted by topic author ssteel

Attached VI will give you some hints.

 

Christian

Message 3 of 8
(3,022 Views)

sorry, my task has been changed, now every 12 hours I have to save data to a file named as the date followed by either 00 or 12 depending on whether the time is between 00-11.59 or 12-23.59. Is this possible. Can someone tell me exactly what the two file paths do which are attached to my write to spread sheet function? If Iwant to do this, do I have to create a load of files already which are named, or can I set this up in the program so that no one has to supervise the change over between files?

 

Regards,

Sam

 

 

0 Kudos
Message 4 of 8
(2,993 Views)

Again, the attached VI from the post before should give you some hints!

You just need to work with the Get/Date/Time String.vi or Get/Date/Time in Seconds.vi to determin when you want to create your new file,

how to create the new file will be shown in the attached VI from before.

 

Christian

 

0 Kudos
Message 5 of 8
(2,985 Views)

But how do u input a file path which is then going to be an input for the write file vi? I need someway to get the date given from the date/time string vi into the name of the file??This is what Im struggling with. Im not sure why there is a file path in and out of the write file aswell??

 

Regards 

0 Kudos
Message 6 of 8
(2,967 Views)

ssteel wrote:

But how do u input a file path which is then going to be an input for the write file vi? I need someway to get the date given from the date/time string vi into the name of the file??This is what Im struggling with. Im not sure why there is a file path in and out of the write file aswell??

 

Regards 


 

Please post an image of your current code so we can follow along. So this is a 24 X 7 anemometer app? Just curious,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 8
(2,964 Views)
it will be hopefully, the aim is to get outputs from 3 accelerometers and 2 anemometers feeding into a spreadsheet. But I'm just starting with the one anemometer. The program so far is attached. My aim is to have a case structure which will create a file called 'the date'_00 and a case structure which will create a file called 'the date'_12 depending on the the output of the time (at the bottom of the block chart). Making 2 files a day. But how do I get these file names in the file path. It is true that if the file name given in the path doesn't exist then the file is created?
0 Kudos
Message 8 of 8
(2,957 Views)