LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble writing excel column titles in my measurement file.

Solved!
Go to solution

my program only writes one line in the csv file for some reason. Bummer.

0 Kudos
Message 21 of 22
(361 Views)
Solution
Accepted by topic author crash_override

So after a little automatic tidying (Block Diagram cleanup, there's a "broom" icon, or you can use Ctrl+U) and then some manual rearrangement, I found this bit:

file.png

The key point here is that every time you open a file, the location that you start at is the beginning of the file.

Assuming that you want to append data, using your current code you'd need to add Set File Position between your Open and your Write, and set the position to "End"

Some description of your problem can be found here: Append to a Text or Binary File in LabVIEW.

 

The more common solution is to open your file before the loop, place the reference in a Shift Register (using Set File Position between open and the SR if opening an existing file), and then keep the reference open until you finish.

 

You then close the reference on the right hand side of the loop, via the outgoing shift register. At the moment, you're not closing your file reference, which is leaking memory (not much, but it will).

Here's an example:

Example_VI_BD.png


GCentral
Message 22 of 22
(341 Views)