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: 

data logging

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!

Phillip Palmer, PhD
0 Kudos
Message 1 of 19
(2,921 Views)

Probably a missing wire, difficult to diagnose without a "picture".  Attach the VI or embed a Snippet, and we can make (more) helpful suggestions.

 

0 Kudos
Message 2 of 19
(2,907 Views)

Can you post your code or a snippet of your code?

0 Kudos
Message 3 of 19
(2,893 Views)

Thanks Bob.  Attached is an image of my VI.

 

 

Phillip Palmer, PhD
0 Kudos
Message 4 of 19
(2,885 Views)

Thats not an image, that is a word document.

Where is the image?

0 Kudos
Message 5 of 19
(2,866 Views)

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.

Philip
CLD
0 Kudos
Message 6 of 19
(2,852 Views)

Sorry.  Here is a .jpg.  If this is not what you need, let me know how to create it.  Thanks for your help!

Phillip Palmer, PhD
Message 7 of 19
(2,836 Views)

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.

0 Kudos
Message 8 of 19
(2,830 Views)

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.

0 Kudos
Message 9 of 19
(2,803 Views)

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!

Phillip Palmer, PhD
0 Kudos
Message 10 of 19
(2,791 Views)