From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving measurment data to a text file or Excel file

Hello, this is my Vi used for measuring temperature with 6 thermocouples. How do i save the measurment data to a text file or xml? Thank you.

Download All
0 Kudos
Message 1 of 18
(2,983 Views)

Well If you dont know file I/O functions then I recommend you to study them all. It is very useful. 

 

To write in to text file you need to create reference (create this outside of any loop) then use "write to text file.vi" in loop to write the data you want and close the reference outside the loop. find image for referece. 

CLAD
Passionate for LabVIEW
0 Kudos
Message 2 of 18
(2,974 Views)

You should also learn to use the Format Into String and/or the Array To Spreadsheet String functions.  They are great for formatting your data into a string to then write to your file.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 18
(2,939 Views)

Dear Blaze888,

 

First of all, let me Welcome You to the NI forums. We look forward to helping you out.

You could approach the question of Data Logging from multiple views. Please look around these hyperlinks:
http://www.ni.com/academic/students/learn-daq/data-logging/
http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/creating_tands_files/

 

What I would recommend you for using is a shift register, where you store the measurement values in an array, and after execution write them to a Spreadsheet file:
http://zone.ni.com/reference/en-XX/help/371361J-01/glang/write_to_spreadsheet_file/

If you specify for example "," (comma) as your delimeter, you will have a CSV file which could be read from excel easily.

Best regards,

Peter

Peter L.
National Instruments Hungary
Applications Engineer
0 Kudos
Message 4 of 18
(2,906 Views)

This is how my block diagram look like. I need to know how to connect the 2 diagrams so i can get the temperature reading to a text file. How exactly do i make the connection between the 2?

0 Kudos
Message 5 of 18
(2,881 Views)

Do you mean to say to read data of one while loop into another while loop?

 

If yes then you can use local variable of your indicator. Right clicking on indicator leads you to several option, there go to create and local variable. 


@Blaze888 wrote:

This is how my block diagram look like. I need to know how to connect the 2 diagrams so i can get the temperature reading to a text file. How exactly do i make the connection between the 2?


 

CLAD
Passionate for LabVIEW
0 Kudos
Message 6 of 18
(2,878 Views)

For future reference, take a look at the Producer/Consumer methodology: http://www.ni.com/white-paper/3023/en/

Using this one could have an Acquisition and a Buffered logger loop running connected by a stream of data. Using Queues.
However if the sampling rate is low in you program, you could just merge the two loops, and put the write function to the actual loop where you gather the samples. (!! Only do this if you are not feeling confident with the other, more robust methods.)

Peter


Peter L.
National Instruments Hungary
Applications Engineer
0 Kudos
Message 7 of 18
(2,871 Views)

Thanks a lot for the information. Howeever i am going to try somethign different. Can't i just use the Write to Measurment file vi and then connect it to the temperature indicators directly. I will save the file in binary format (TDMS) which i later plan to opel with Excel with the TDMS Lab View plugin that LabView atutomatically installs. Won't that work?

0 Kudos
Message 8 of 18
(2,796 Views)

@Blaze888 wrote:

Thanks a lot for the information. Howeever i am going to try somethign different. Can't i just use the Write to Measurment file vi and then connect it to the temperature indicators directly. I will save the file in binary format (TDMS) which i later plan to opel with Excel with the TDMS Lab View plugin that LabView atutomatically installs. Won't that work?


That's the way I'd do it! except fo one small change.  Since the only thing you are logging is a DAQmx Read.  just set the task up to log!

 

!1.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 18
(2,793 Views)

Whats the purpose of that image? I need to create that?!

0 Kudos
Message 10 of 18
(2,787 Views)