01-23-2014 10:18 AM
Hi,
I am trying to write data to a file. I am using Open/Create/Replace file outside a While loop, Format into String and Write to Text File within the While loop, and finally, Close File outside the While loop. I check errors before entering Format Into String, after Write to Text File and after the Close File. There are no errors reported, but there is no data file in the directory. I have tried this with Write to Binary File too with the same result: no data file. Any help would be appreciated!
01-23-2014 11:07 AM
Probably a missing wire, difficult to diagnose without a "picture". Attach the VI or embed a Snippet, and we can make (more) helpful suggestions.
01-23-2014 12:02 PM
Can you post your code or a snippet of your code?
01-23-2014 12:20 PM
Thanks Bob. Attached is an image of my VI.
01-23-2014 01:35 PM
Thats not an image, that is a word document.
Where is the image?
01-23-2014 02:42 PM - edited 01-23-2014 02:48 PM
On the open/create/replace vi, you didn't specify the file path. EDIT: oh yeah, that will just bring up a file dialog, try wiring a hard path like "C:\Test.txt" or something. Your logging code works for me so you can't be too far off.
01-23-2014 03:12 PM
Sorry. Here is a .jpg. If this is not what you need, let me know how to create it. Thanks for your help!
01-23-2014 03:32 PM - edited 01-23-2014 03:33 PM
That all looks like it should be working fine, are you sure that labview has permissions to write to file? Did you assign a file to write the data to rather then a directory? Next time you run the program create a dump text file and when you are prompted with the file dialog select that file to write to and see if that makes a difference.
Secondly if those don't work try this file and select the same dump text file. It works fine for me and should just create a dump of random numbers. If this works then try working your data generation in there.
[Edit] Just had a thought, are you trying to write to a network drive? If so then switch your write location to a local drive and try again.
01-24-2014 06:35 AM
It seems like you are using a sbRIO.
Do you get a file dialog when you run the VI ?
Remember that it is a sbRIO, it does not have access to your PC's folder. It has its own folders that it can write to.
01-24-2014 07:07 AM
You are correct that I am using the sbRIO and I do not get the file dialog box. However, I wrote a separate VI which was just quite simply a sine wave generator in a While loop. I put a file create outside the loop, a Write to File inside the loop (with input from the sine wave generator) and a Close file outside the loop. That was all. And I did get the file dialog box and I was able to save to my desktop on my PC (though I did not try other locations.)
I will try to learn more about the sbRIOs folders, but if you have other suggestions that would be most appreciated! Thanks again!