cancel
Showing results for 
Search instead for 
Did you mean: 

Format two 2d arrays to Excel

SOLVED
HEWI
Member
Solved!

Format two 2d arrays to Excel

Hello all,

 

Just a quick, probably simple question. Have been reading trough the forum, but couldn't find the answer.

 

I have two 2d arrays which I want to save to en excel file. Till now I have simply implemented this by using write to measurement file function without any problem. Unfortunately the two 2d arrays are just next to each other, no empty cells in between to divide the two arrays. As well i'd like to put a header above each 2d array. Just something like below:

 

Voltages:

5 4 2 8 3

7 0 2 5 1

6 8 2 3 3

 

Amperes:

1 2 3 5 2

7 9 4 2 5

2 1 1 6 3

 

Any help, ideas or example vi's are welcome!

 

Best regards,

WHW

8 REPLIES 8
Artem.SPb
Active Participant

Re: Format two 2d arrays to Excel

Do you have  LabVIEW Report Generation Toolkit for Microsoft Office?

HEWI
Member

Re: Format two 2d arrays to Excel

Thanks for reply Artem.SPb

No I dont.

 

I was wondering if it is possible to fix this by putting everything in one big 2d array and inserting an empty row in between. And of course two rows with the header for each array.

Does anybody know a trick to create 'empty' rows? I know its not the nicest way of programming but yea... Smiley Frustrated

 

Regards,

WHW

GerdW
Knight of NI
Solution

Re: Format two 2d arrays to Excel

Hi HEWI,

 

I was wondering if it is possible to fix this by putting everything in one big 2d array and inserting an empty row in between.

Yes, that's possible. And it would fix your issue…

 

Does anybody know a trick to create 'empty' rows?

Yes.

Spoiler
Create an array of empty strings. As I would create spreadsheet files (aka CSV files aka formatted text files) I would convert those arrays to string arrays anyway. And putting row/column headers into you need to use strings also!

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
HEWI
Member

Re: Format two 2d arrays to Excel

Btw I'm open for any other ideas to put the two 2d arrays separated and with a header in an excel sheet, but if possible i'd like to stick to the write to measurement function since it's simple.

 

Regards,

WHW

GerdW
Knight of NI

Re: Format two 2d arrays to Excel

Hi HEWI,

 

Btw I'm open for any other ideas to put the two 2d arrays separated and with a header in an excel sheet,

Use several WriteToSpreadsheetFile function calls…

 

if possible i'd like to stick to the write to measurement function since it's simple.

If something is "simple" it may not allow for more complicated tasks… Smiley Very Happy

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
HEWI
Member

Re: Format two 2d arrays to Excel

Message contains an image

Thanks for your reply GerdW,

 

Thats excactly what I was thinking of.

But then the question how to combine those, headers, empty string and arrays, i cant just combine those things since they are different dimensions.

 

array.png

 

Best regards,

WHW

GerdW
Knight of NI

Re: Format two 2d arrays to Excel

Hi Hewi,

 

when you have a 2D array of values you surely want to use an 1D array of headers (for rows and columns). Think about it…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
HEWI
Member

Re: Format two 2d arrays to Excel

Okay, have my big 2d array of strings with headers, data and empty rows now! 

 

Last question is how to convert the array of strings to dynamic data so that I can wire the array to the write to measurement file function.

 

Best regards and thanks in advance,

WHW