LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create a log file

I'm very green and looking for some help.

 

I'm looking to create a log file that would look like this

 

Name, Date

P

I

D

[Time][AI0][AI1][AO1]

[1:00.25][data][data][data]

[1:00.5][data][data][data]

[1:00.75][data][data][data]

 

0 Kudos
Message 1 of 9
(9,073 Views)

You will find what you need in the under the Files and Strings palettes. For the file you will want to use OPen, Write to Text File and Close. Open or create the new file in the beginning of your program and close it at the end. Use the Format String VI to create the format and content of your log file. You can find examples for formatting strings and writing to files in the examples that ship with LabVIEW.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 9
(9,069 Views)

Thanks for the help Mark,

 

Might you know where I find these examples?

0 Kudos
Message 3 of 9
(9,062 Views)

Use the "Find Examples" under the help menu.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 9
(9,052 Views)

As the other poster mentioned, you should go ahead and explore the examples on the subject of strings:

concatenate strings.vi looks interesting.  Check out the "array of strings" tab.  

 

Bobby Breyer
Applications Engineer
National Instruments
0 Kudos
Message 5 of 9
(9,012 Views)

Here is a simple log file:log file.png

 

0 Kudos
Message 6 of 9
(6,346 Views)

How does such a simple example warrant reopening a 7 year old thread to post this?

 

If you tried to add another line to the "log file" later on, do you know how your example would behave?

0 Kudos
Message 7 of 9
(6,341 Views)

Because there was no simple example!!

You use the Write to Text File multiple times and it will add lines to text file.

0 Kudos
Message 8 of 9
(6,292 Views)

@msidler wrote:

Because there was no simple example!!

You use the Write to Text File multiple times and it will add lines to text file.


No.  If you repeatedly run the code you attached, only the last thing written will be saved in the file!

 

Every time you open the file, the file pointer is at the beginning, if you write a line, all other lines in that file will disappear.

0 Kudos
Message 9 of 9
(6,286 Views)