LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing data during while loop execution

I have a while loop that writes data to a file. The file itself is opened outside the while loop (I have a header write to the file only once but have continuous data logging). But, the information will not exit the while loop until the loop stops. Since the while loop runs until the stop button is pressed, I would like to know how I can send the data to be written to the file while the while loop continues to execute.
0 Kudos
Message 1 of 4
(3,024 Views)
You need to put the write operation inside the while loop (append mode).
0 Kudos
Message 2 of 4
(3,024 Views)
Can you just put your write VI inside the while loop ?? if this slows your loop down too much maybe you can use Queues and parallel while loop to do the actual writing...

Dan
0 Kudos
Message 3 of 4
(3,024 Views)
There are several ways that you can do this. One way would be to open the file and write the header before entering the while loop and passing the reference to the open file into the while loop to write a new line at every iteration. I think that this is the behaviour that you are looking for. There is no need to collect the data at the edge of the while loop and build a huge data array if you do not need the data for further processing outside the while loop.

If this approach is not practical you may consider using a queue to pass the data from one location in the program to another. You can find good examples of using a queue in the LabVIEW examples.
0 Kudos
Message 4 of 4
(3,024 Views)