04-11-2012 11:20 AM
Hi
I just created a very simple VI which would write strings to a text file.
When I select the "open" or other operations with open, the string will be written to the text file repeatedly.
Thanks for the help!
04-11-2012 12:59 PM
The reason is writes the string repeatedly is because every time the loop iterates it opens the file, goes to the end of the file, writes to the file and closes it. There is no control at all.
Do you want it to write the text to the file when the text input changes value? Maybe when some "write" boolean is pressed? You gotta trigger this off some event if you don't want it to always write the string to the file.
04-11-2012 01:16 PM
@zeta_6 wrote:
I just created a very simple VI which would write strings to a text file.
When I select the "open" or other operations with open, the string will be written to the text file repeatedly.
Thanks for the help!
Where do you need help? I cannot identify anything you wrote as a question, so let's look at your VI.
Your loop opens the file, sets the file position to the end, writes the string, closes the file and start over a nanosecond later. You probably could fill your HD if you accidentally keep it running. 😮
When you write repeatedly to the same file, it is much more efficient to open the file once before the loop starts, then keep writing in the loop. Now the position is automatically at the end, no need to set it. After the loop stops, close the file.
So, what was the question you had?
04-12-2012 05:09 AM
So sorry for my language.
I think what I meant was my loop will keep running, and the text file would only be written in when the input has new values. I intend to build a temperature monitor system. And my data acquisition is fine. I just want to put the recorded data into a text file. A new text file would be created every day to record all the data in that day with recoding time. | just don't quite understand how the write to text file function works.
Thanks for the help!!!
04-12-2012 05:10 AM
I will try add "boolean" to the function
Thanks for the help!!!