LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW : How to export a 1D array faster to a .xlsx file

Solved!
Go to solution

Hello everyone,

 

I'm currently using LabVIEW (2020 SP1) to automate testing of electronic boards and laser diodes. At the end of each test bench, a large amount of data needs to be exported into a .xlsx file.

 

To do this, I load an Excel template, fill it in with the new data, and then save a copy locally.

 

The issue I'm facing is that the export process is very slow, it takes approximately 15 minutes to complete.

 

I can't share the full code here, but I can show the key parts.

 

Here’s how I create the .xlsx file:

rpbrn_0-1759843704886.png

And here's how I export most of the data :

rpbrn_1-1759843747285.png

This process is repeated multiple times throughout the export.

 

From what I can tell, the bottleneck seems to be this part:

rpbrn_2-1759843860668.png

As the 1D array that I'm trying to export contains around 300 values. 

 

Has anyone encountered a similar issue or found a way to speed up Excel export in LabVIEW?


Any suggestions or best practices would be greatly appreciated!

 

Kind regards,

 

Raphaël

0 Kudos
Message 1 of 9
(420 Views)
Solution
Accepted by topic author rpbrn

Instead of writing individual cell to the Excel template, try build a 2-D array in LabVIEW, write everything to the template in one call.

 

 

George Zou
0 Kudos
Message 2 of 9
(406 Views)

Hello George,

 

I thought about doing so. But I only have 1 column of useful data.

 

Is it possible to create a 2D array with a "void" column ?

 

Raphaël

0 Kudos
Message 3 of 9
(394 Views)

If I remember correctly, write to a column need a 2-D array.  Use the Build Array function to convert a 1-D array to 2-D.

 

 

George Zou
0 Kudos
Message 4 of 9
(386 Views)

I wasn’t able to convert my 1D array into a 2D array, but I managed to merge my 1D array with an existing 2D array and export the resulting 3D array all at once.

 

The export process is indeed much faster.

 

Raphaël

 

 

0 Kudos
Message 5 of 9
(334 Views)
Solution
Accepted by topic author rpbrn

Hi Raphael,

 


@rpbrn wrote:

I wasn’t able to convert my 1D array into a 2D array, but I managed to merge my 1D array with an existing 2D array and export the resulting 3D array all at once.


Whatever you did you did it wrong!

There is no "merge array" function: what exactly did you try to implement?

 


@zou wrote:

Use the Build Array function to convert a 1-D array to 2-D.


It should be as easy as this:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(324 Views)

Hello GerdW,

 

You're right, it turns out I didn't fully understand how the "build array" function works with 1D arrays!

 

Here's what I did : 

rpbrn_1-1759910065121.png

 

Perhaps "merge" wasn't the right word ? If so, sorry, english isn't my first language.

 

What I meant was that I used the "build array" function to combine three 1D arrays into one.

 

Kind regards,

 

Raphaël

0 Kudos
Message 7 of 9
(310 Views)

Hi Raphael,

 


@rpbrn wrote:

Perhaps "merge" wasn't the right word ? If so, sorry, english isn't my first language.

 

What I meant was that I used the "build array" function to combine three 1D arrays into one.


Which LabVIEW language version do you use? There context help shows the English name of each function!

 

Building 3 1D arrays results in a 2D array: the context help shows also the datatype of each wire the mouse pointer hovers over!

 

Like this:

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(303 Views)

Oh you're right, the context help window does show the english name of the function. 

 

Thanks again for the explanations GerdW !

 

Kind regards,

 

Raphaël

0 Kudos
Message 9 of 9
(294 Views)