LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with writing continuous data to excel using using Report Generation vi's

Hey Everyone,

 

I am trying to read the data from DAQ and write to excel continuously using Report Generation vi's. 

But when I run the VI, it writes only one interation of the while loop (gathering data from DAQ continuously) and doesn't append the data into the same file when I run it again after stoping the VI. 

I have attached the VI i created. Please let me know if you have any idea to solve this issue. 

 

Thanks

0 Kudos
Message 1 of 7
(2,774 Views)
The first thing you need is a different approach to the problem. The report generation VIs were not designed to provide performance that can keep up with a DAQ input. You should look into TDMS.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 7
(2,759 Views)

I agree with mikeporter, you should be using either TDMS or just write to spreadsheet and append the file

0 Kudos
Message 3 of 7
(2,741 Views)

There are two problems with your VI.  First, the basic logic of writing/appending to a file (Excel, TDMS, anything) should go something like this:  Open the file, position yourself at the end of the file, then, in the loop, acquire data and write it to the file until you are finished with data acquisition.  When you exit the acquire/write to file loop, then close the file.  In particular, the opening and the closing of the file should not be inside the loop.

 

As others have pointed out, writing to Excel might not be optimal, particularly if you are acquiring data at a high rate (and would therefore be writing a lot of data). We actually use Excel in our data acquisition routine, mainly reading from a WorkSheet to get the parameters of a particular stimulus, but also writing the outcome of the response to the stimulus.  As it happens, our "acquisition rate" in this example is on the order of several samples per minute, so there's no problem using Excel (we also sample 16 channels of analog data at 1 KHz -- this gets written as a binary file).

 

Second, if you really do want to use Excel, use the (existing) Excel file to which you want to append as the "template" argument of the New Report function.  Then use the Excel Get Last Row function to position yourself at "end of file", as noted above.

 

Good Luck.

 

Bob Schor

0 Kudos
Message 4 of 7
(2,728 Views)

Thanks everyone for the feedback. 

I tried the tdms and its working good so far, except for one thing.

I was wondering if there is any  way I can write to specific worksheet of an excel workbook?

 

0 Kudos
Message 5 of 7
(2,682 Views)
One option would be to use the TDMS file to save the data while the test is ongoing and then at the end resaved it to an excel file using the report generation VIs.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 7
(2,674 Views)

The Write to Measurement File express VI in 2013 supports making XLSX files in a way that is likely faster than the Report Generation toolkit, but has many more limitations.  You might want to give it a try if you don't mind the format limitations.

 

Or write to CSV appending data to an existing file.

 

Or TDMS as other suggested and convert after the test is over.

0 Kudos
Message 7 of 7
(2,639 Views)