LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Write To Measurement File Express VI not writing to file if file was deleted after the first call (7.1)

I'm using the Express Write to LabVIEW Measurement File in LV7.1.
 
I have it set to "Save to one file"  and have tried both "Overwrite file" and "Using next available file name" for the "If a file already exists" conditions.
 
The path/filename is passed into the function.
 
It works fine the first time around.  If the file is deleted before the function is called again, an error occurs since LV is unable to find the file.
 
I have had to stop and re-run my program in order to write to use the function again.
 
Since I am able to delete the file I assume it was closed but it seems like LV expects it to be there, even though the function was supposed to create/open/close the file...  Is there any way to reset this without stopping/restarting the program?
 
Since my application creates several files (only one using the Express VI) I am checking for the filenames and requiring that they be deleted (or a new filename be used) before acquiring data.  Everything has worked great, except for the Express VI.
 
Thank you,
 
David
 
0 Kudos
Message 1 of 6
(3,323 Views)
Hi David,
 
Please look at the attached VI (LV 7.1) that shows an example of using the express vi Write LV Measurement to File.
Feel free to attach your code, so that I can tell you what you can change to make it work.
 
Best regards,
Kalin T.
0 Kudos
Message 2 of 6
(3,299 Views)
Ok, I've edited the VI you posted to reproduce my error (this time with 8.0). 

I added a "master stop" and "start log" button.  To demonstrate my problem:

1.  Run the VI
2.  Click "START LOGGING" - c:\test.txt is created
3.  Click "STOP" - c:\test.txt is closed
4.  Delete the file c:\test.txt with Windows shell or explorer
5.  Click "START LGGING" - a new c:\test.txt file should be created but instead an error is raised in the Write LabVIEW Measurement File function.

Any ideas?

Thanks,

Dave

0 Kudos
Message 3 of 6
(3,290 Views)

I'd started with a different VI, but it's very similar to your test VI.

You will need to make use of the "reset" flag if the data file you're writing to can get deleted out from under the write.  See the attached VI for an example of how to do this.  Hope this helps!

0 Kudos
Message 4 of 6
(3,279 Views)

Hi Dave,

Follow Jeff's suggestion. The description of the Reset input is: "If TRUE, stops and restarts writing data to the .lvm, .tdm, or .tdms file based on the Action or If a file already exists options you select in the Configure Write Measurement File dialog box. The default is FALSE."

Hope that helps!

Kalin T.
0 Kudos
Message 5 of 6
(3,269 Views)
Thanks, the reset flag does the trick!


0 Kudos
Message 6 of 6
(3,252 Views)