LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

First time using "Reports", do I call Excel too often?

Solved!
Go to solution

Hello! I am trying the "Reports" vi's to make Excel spreadsheets, where normally I would use write to delimited spreadsheet. I want to write data to the file as it is generated (~1 Hz) rather than when the program closes. I have made a little test loop that seems to work, but I want to check and make sure I am not going to cause some MS Office meltdown on a user computer even if it works on mine. I'm a little worried about how it seems to need to actually call Excel every iteration, and I don't know if there are any problems wit doing this. Thanks for any input!

0 Kudos
Message 1 of 5
(947 Views)
There's nothing inherently wrong with saving the data to an Excel file, 1 Hz is pretty slow. But, I would still avoid it. If you're requirements change and you need a much faster data rate, you could run into problems. I would make sure the Excel sheet is hidden. If the user tries to interact with it when the test is running it will generate errors.

How much data does an Excel sheet typically have?
Why do you want to write data to file many times during the test?
Message 2 of 5
(918 Views)
Solution
Accepted by topic author bgalfond

The RGT does, indeed, call on Excel to do the file I/O for you.  If you are writing an Excel Worksheet at the rate of one line a second, you really should not need to worry about it (unless you are concerned about seeing Excel on your screen, adding rows and doing all that Screen I/O).  Note that you can have Excel work "silently" (or, maybe better, "invisibly") by setting the "Minimize" option in the New Report call, which keeps the Excel worksheet off the screen.

 

We had an application that involved behavioral tests for human sound localization.  We created an Excel Workbook that "ran the study" -- a "Trials" Worksheet had about 160 columns that specified all of the options for a particular test ("Wait N seconds, play a masking sound of such-and-such frequency/amplitude/time, flash a target laser at this point in space for this many seconds, play a test sound here, wait this long, flash a laser dot that tells the User to point to where the sound appears to be and press a button to record this choice").  Each line of the Spreadsheet is another trial.  A Trial takes about 30-40 seconds, there are about 60 Trials (so this WorkSheet is 60 rows of 160 columns, updated every 30-40 seconds).

 

In this example, we basically read the first 150 or so columns, write data in the last 10 or so (like where the Subject thought the sound was located), but the bulk of the data, sampled from 16-20 channels sampled at 1 kHz, were not saved in Excel, but were saved in a simpler format (I'm not 100% certain, now, what I used -- the code was written 6-8 years ago).

 

Bob Schor

Message 3 of 5
(893 Views)

When I do the delimited spreadsheet I do hide the files, and I tried to in the example here, however it seemed to automatically unhide after the report saved - I think I would need to hide it every time the loop ran which seemed like more to go wrong. My solution would be to put the file in a folder the user doesn't know and have an Explorer window open when the program closes.

 

I have two user types:

 

Students see files in the sub 1 MB range. I want continuous recording because even having a giant red STOP button and disabling the abort button doesn't stop them from ctrl-alt-del and force quitting.

 

My second user type is research, which can have runs that go on for days, so still larger but only in the dozens of MB range. Here I am more worried about losing data should something go wrong.

 

I'm kind of leaning to having a backup delimited sheet and writing an excel report on proper shutdown...

0 Kudos
Message 4 of 5
(872 Views)

I need to check again, but it seemed having "minimize" would flash an Excel window up and minimize it, while "unchanged" never even showed Excel in the task bar. Could easily be an Excel version thing though.

 

Yeah, I like what you are describing. I'll probably continue having a delimited spreadsheet I just add lines to, and then run a report at the very end. I let my program run for an hour and didn't see noticeable memory usage creep, but i can see trying to plug this in to a system recording more stuff and it being an issue.

0 Kudos
Message 5 of 5
(868 Views)