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: 

Speeding Up Load Array From Excel subVI

Solved!
Go to solution

Hi there,

 

I've got a subVI that loads a 2D double array from an Excel file. Currently, it needs about 500ms between runs to not cause a variant error, something to do with getting everything opened and closed. I was wondering if anybody could see anything obvious that's slowing it down. If you could help me optimise this a little that would be great. Even if I could shave it down to 200ms.

0 Kudos
Message 1 of 7
(2,274 Views)

Sorry,

 

forgot to attach the subVi.

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

What do you mean "between runs?".  Are you running this subVI multiple times?  If so, you should open the app reference outside the subvi and leave the reference open between runs (and don't quit Excel). 

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 3 of 7
(2,270 Views)

I pass an array of filenames into the subVI. It might contain 1, or it may contain 10. So I don't know whether or not I'll need to run it multiple times.

0 Kudos
Message 4 of 7
(2,267 Views)
Solution
Accepted by topic author Chris Johnson

Here is a quick example of what I'm talking about.  Placing the App reference open/close outside the loop gets you down to around 300 ms.

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
Message 5 of 7
(2,260 Views)

Hey, sorry to be a pain, for some reason I can't download that file, something to do with my network I'm sure. Any chance you could email it to me? chris84948@gmail.com

 

Thanks

0 Kudos
Message 6 of 7
(2,252 Views)

That worked great. Now the total cycle time is down to about 300ms. I was worried that if everytime I added a new file to the array we would add 500ms, I would be taking 5-10 seconds on a larger recipe setup.

 

Thanks again.

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