LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

create a new folder to save files each time program is run

I have a program that initializes an acquisition from my pxi 5122 card and saves the acquisition to disk via labview. I have specified what path to save the files to, but every time i try to re-run the program, i get an error message saying  "duplicate path", so i am forced to delete all the acquired files in order to save new ones each time i run the program. So i think it wants a different path every time the program runs.  So my question is, how do i make the program save the files to a new/separate folder every time the program runs, possibly by using the current date and time in the file/folder name in order to create a unique one after each iteration. Thank you.
0 Kudos
Message 1 of 11
(7,977 Views)

I would say you answered the question your self.  Get the date\time string and simple build a file name from that using the String VIs.  Then use the path you already have to a parent directory you want and the Build Path VI to create the path with the new name.

If that doesn't work for you attach your VI so we can see if there is something else that we are missing.

0 Kudos
Message 2 of 11
(7,970 Views)

Hi, thanks for your response, i knew that i might have to use the date/time in the filename etc, but the problem is i was having problems actually getting the date/time and using it with the filename. I have attached the VI.

PS feel free to modify it as u like, i order to acheive the desired result.

thank you.

0 Kudos
Message 3 of 11
(7,966 Views)
Take a look at the attached where I just added the "Get Date/Time String" VI to get the strings.  I then concatinate them just like you had the loop index.
0 Kudos
Message 4 of 11
(7,961 Views)
Thanks a lot mate, i now understand how to get the time and date and concatenate them into the filename/path as you have done. I have run the program, and as soon as an aquisition is made, the program breaks and comes up with the following error message: "An Input parameter is invalid" and below that it says "NI-488: command requires GPIB controller to be controller in charge". I dont understand what the error message means, but i have to say you've been very helpful so far though.
0 Kudos
Message 5 of 11
(7,955 Views)
What is the number associated with the error and does it tell where?
 
In your code there are 2 areas that could generate errors.  Is the error asking you if you want to stop or continue?  If yes then it is the file section that is mad.
 
if not then there is some parameter or setting you are making in the Scope section that is wrong.  To debug that turn on highlight execution and see which VI generates the error.
0 Kudos
Message 6 of 11
(7,952 Views)
Hi, yes it does ask me if i want to continue or stop, and if i click continue it just stays dormant and does nothing. I think the area that has got problems is probably when it tries to close the file, beacuse a black highlight flashes over the function that closes the file when the error mesage pops up. The error number is NI-488.
0 Kudos
Message 7 of 11
(7,951 Views)
At the top of the dialog it should say something like
 
Error # occured at ----.vi.
 
Because the path I am giving is bad I get
Error 1 occured at Open/Create/Replace File in finalVersion1.vi
 
Either way I think I know what the issue is.  I wasn't paying a whole lot of attention when I added the code in.  The date and time strings have "bad" characters for the file name.  We are trying to make a file name C:\Documents and Settings\Administrator\My Documents\LabVIEW Data\pete5/31/200611:28:53 AM.tdm
 
So we need to insert into the VI code to replace the "/" and the ":".  See the attached V I
Message 8 of 11
(7,947 Views)
Sorry i couldnt get back to you yesterday, i had to go home from work. Yes this program works perfectly and this is just great. The program will now be suitable for the kind of thing i want to do with it. Thanks a million.
0 Kudos
Message 9 of 11
(7,931 Views)
Hi, thanks for your previous help. I have got a little  modification for the program. Id like to get the program to work in such a way that every time i run the program, it creates a new folder/directory with the present date/time embedded in the folder name, then saves all the captured files into that directory, as opposed to the way the program currently works where it creates a new file with the time/date every time it captures data. Hope the question is quite clear, if not let me know and ill clarify.
0 Kudos
Message 10 of 11
(7,908 Views)