LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add data to txt file

Hello,
 
can anybody please tell me how to add data to a text-file without overwriting. I read that I have to set the append boolean to True, but there is no append boolean on my "Write to text file" VI.
What I want to do is to continually add waveform data to an existing text file at a defined rate. 
I appreciate any help.
 
Franzi
0 Kudos
Message 1 of 14
(3,954 Views)
What version of LabVIEW are you using ?

If LV 8 and later, I have no idea...
If LV 7.1 or earlier, I can dig out some examples.

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 14
(3,946 Views)
Hi Franzi

You could use the Write Characters to File.vi (which has the append input), but if you want to continuously add data to the file I'd rather use the Open/Create/Replace File.vi to open a file reference and then the Write File function to write the data (pos mode set to current). After finishing the write process, don't forget to close the file (Close File). All the mentioned functions can be found on the File I/O palette (LV 7.1).

Regards, Daniel

0 Kudos
Message 3 of 14
(3,945 Views)

Thak you TiTou and dan_u,

I am using LabView 8. I use the "Open/Create/Replace File" VI to open the file and intend to write the data to the file with the "Write to text file". I hope that this is the right approach. The writing works correctly except that I have no idea how to start writing at the end of the file.

0 Kudos
Message 4 of 14
(3,941 Views)

In this Link

Read following section

" If a path is wired to the file (use dialog) input, the function opens or creates the file before writing to it and replaces any previous file contents. If a file refnum is wired to the file (use dialog) input, writing begins at the current file position. To append to an existing file, set the file position to the end of the file by using the Set File Position function. Use the Set File Position function if you need to perform random access"

Hope this helps

 

Message 5 of 14
(3,938 Views)
I have to say I really don't understand why NI LabVIEW team decided to change the functions of the File I/O palette for LV 8...
That was a very bad idea since new functions don't seem to match those we had before Smiley Sad or maybe I just didn't find it..

In LV 7 there is a dropdown control which let you chose "at end", "at start", "current position"... Where is that gone Smiley Surprised ?

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 6 of 14
(3,936 Views)
Thanks Dev, you answered my question before I asked it Smiley Very Happy

But still... why such such a change ? I think it was more convinient in LV 7.1 where you could set the position on the Write to File function...

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 7 of 14
(3,930 Views)
@TiTou: You're sure that doesn't exist in LV8? We're planning to switch from 7.1 to 8.20 soon, but this might cause some extra work.... Maybe it'll turn out as you write in your signature.... Hating LV8 😞


Message Edited by dan_u on 08-30-2006 11:19 AM

0 Kudos
Message 8 of 14
(3,933 Views)
Sory Dan... as Dev said, it IS possible and I just didn't know how to do it Smiley Sad

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 9 of 14
(3,928 Views)
But anyway, I also think it'll complicate things and requires some extra work when switching to 8.20...
Good to know in advance how to do it... Thx.
0 Kudos
Message 10 of 14
(3,921 Views)