LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write to file on demand

Hi all
I have a while loop where i read my analog signals. I just want to write them to a text file (that will be opened with excel out of LV environment) when i push a button on the front panel. Pushing the button again will stop the writing. I even want to write a header for each column (a column for the date, another for the time, another for the first pressure and so on...). This is the problem... till now, using my wrong method, i write a line of signal and a line of header and so on, but i wanna just the first line with headers. How can i do?
Any suggestions will be appreciated! Thanks

Kind regards
I love the smell of napalm in the morning
0 Kudos
Message 1 of 6
(3,316 Views)
Write the header before the loop, then append new rows inside the loop.
0 Kudos
Message 2 of 6
(3,308 Views)

Have you tried the Write To Measurement File function ?

FunctionPalett>>File I/O >> Write Meas File.

It is a wonderful wizard which helps you working out simple tasks like the one you are facing.

Best Regards

 

FiloP
It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong.
Richard P. Feynman
0 Kudos
Message 3 of 6
(3,284 Views)
Hi all
I have done it exatly as i wanted!!
It took a while (i'm a beginner) but at the end my VI works properly! I wanna share with you my solution.
Anyway thanks for the suggestions.

Kind regards
Ciao

p.s. it's not my real VI but the concept VI that lead to my real one.
I love the smell of napalm in the morning
0 Kudos
Message 4 of 6
(3,272 Views)
A few quick comments:
  • The boolean AND is not needed, it is implicitely taken by the case structure (You only get the TRUE case if the value is true anyway).
  • The "not equal" belongs inside the case structure, there is no need to calculate it when the case is false.
  • There is no need to write to the file twice when you write the header and the first line of data.
  • For code readablility, it is recommended to keep file refs and error clusters horizontally aligned.
  • You are not really utilizing the error cluster. If an error occurs, nothing happens and the operator does not get notified.
  • There is a problem with timing if the operator takes a long time to work the file dialog. A better solution would be to have a path control on the front panel and activate the new file case whenever the path changes.

Attached shows a few alternatives. Modify as needed.

Message Edited by altenbach on 10-23-2006 09:16 AM

0 Kudos
Message 5 of 6
(3,249 Views)
Hi Altenbach
Thank you for the suggestions and for your precision.
It's a pleasure to learn things from you.

Best regards.
I love the smell of napalm in the morning
0 Kudos
Message 6 of 6
(3,227 Views)