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: 

problem with creating a folder and file, reading in header and data

Solved!
Go to solution

I want create a new folder named by time, and then generate a txt file inside this folder: reads in the header information first and then reads in data, but the problem is that if there exists this folder, the header will appear in the file, if this folder is not existed, the header will not appear in the txt file.

 

Thanks for your help.

0 Kudos
Message 1 of 6
(2,619 Views)

Have you tried the Check if File or Folder Exists function (found on the Advanced File Functions on the File I/O Palette)?  If your folder does not exist, create it.  Now you know you have a valid folder, so build your path by using the Folder and your desired File Name.  You are using Build Path, aren't you?

Message 2 of 6
(2,601 Views)

My aim is to create a new file and within the same run write header info.(using Write to file) and data (using Write to Measurement file) into the txt file inside the folder.

I create the path by combining the input file path and time.

 

I'm not sure I understand your meaning. I'm so sorry.

 

0 Kudos
Message 3 of 6
(2,588 Views)
Solution
Accepted by topic author junniji

Hi Junniji,

 

Check the attached vi. I have done what Bob was trying to explain in the vi. I have documented the steps in the block diagram. Have a look. I had few comments on your code as well. Always try to connect the error wires when coding and try to keep the code neat so that its easy to debug and understand the flow (even if it is a test code :)).

 

There was a subvi missing in the vi which you sent. I hope you'll have it in your pc 🙂

 

regards,
Nitzz

(Give Kudos To Good Answers, Mark it as a Solution If your Problem was Solved :smileywink:)

Message 4 of 6
(2,561 Views)

It works. I'm so happy that my first project finally works.Cat Very HappyThanks very much. And also thanks for your advise.

0 Kudos
Message 5 of 6
(2,545 Views)

Hi Junniji,

 

We all are always happy to help.. 🙂

 

regards,
NitzZ

0 Kudos
Message 6 of 6
(2,510 Views)