LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to export data from two waveform charts (from 2 analog inputs on the same DAQ) to excel

Hello,  

 

LabVIEW software: LabVIEW 2020 SP1

DAQ device:  NI USB-6210

 

I'm having some trouble exporting data from a waveform chart (named: "Load Cell") and another waveform chart (named:  "LVDT") to a text file or excel sheet.  So I have a total of 2 analog inputs on the same DAQ device.

 

I want to be able to have "Load Cell" values populate one column, and I want to be able to have corresponding values "LVDT" values populate the adjacent column.  So for example, the text file I want to have would have the following format:

 

Date    Time     LoadCell(mg)      LVDT

                           5.0                       3.1

                           3.4                        4.5

                             .                           .

                             .                          .

                            x                           y

 

I've been able to print data to a text file when I'm only recording one analog input by using the "write delimited spreadsheet" LabVIEW function (see file "Load Cell noise elimination testing").  But when I do the same procedure when trying to record both analog inputs (see file "Finalized VI_Olivia_testing"), my results show a bunch of zeros going down both columns, as if no data from the two waveform charts is being correctly populated into the text file.  In the file name "Finalized VI_Olivia_testing", I have deleted my attempts of using the "write delimited spreadsheet" function because it was messy. 

 

Can someone please help me modify the "Finalized VI_Olivia_testing" file or give me some advice so that I can export the data from both waveform charts into two columns on a text file?  I would greatly appreciate the help.  Please let me know if you need any other information

 

Thanks,

Andrew

0 Kudos
Message 1 of 2
(912 Views)

Hi Andrew/Olivia,

 


@avb2132 wrote:

Can someone please … give me some advice so that I can export the data from both waveform charts into two columns on a text file? 


Did you do the basic LabVIEW training courses? Did you learn about coercion dots and their meaning? (Read the LabVIEW help on that term!)

 

You are reading waveforms from DAQmx, but then you convert those waveforms to a string with a BIG RED COERCION DOT on the FormatIntoString functions! This is the part in your code where you lost all the data…

 

  • Why don't you use the DAQmx feature to save the measurement data into a TDMS file automatically? No need for conversions and file handling!
  • Why don't you set the number of samples to read at the DAQmxRead function?
  • Why do you use InsertIntoArray when you want to build an array??? Use BuildArray instead!!!
  • Why don't you apply a scale on the DAQmx virtual channel for your load cell? No need to calc the scaled values on your own!
  • Why do you use the "n samples" mode of DAQmxRead at a sample rate of 5Hz? Why not read the samples one by one? This would greatly simplify your text file later on!

To give an idea:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 2
(867 Views)