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
Highlighted

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
(966 Views)
Highlighted

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
(948 Views)
Highlighted

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
(935 Views)
Highlighted
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
(908 Views)
Highlighted

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
(892 Views)
Highlighted

Hi Junniji,

 

We all are always happy to help.. 🙂

 

regards,
NitzZ

0 Kudos
Message 6 of 6
(857 Views)