LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format two 2d arrays to Excel

Solved!
Go to solution

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

0 Kudos
Message 1 of 9
(3,654 Views)
0 Kudos
Message 2 of 9
(3,631 Views)

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

0 Kudos
Message 3 of 9
(3,623 Views)
Solution
Accepted by topic author HEWI

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
Message 4 of 9
(3,611 Views)

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

0 Kudos
Message 5 of 9
(3,609 Views)

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… 😄

Best regards,
GerdW


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

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

0 Kudos
Message 7 of 9
(3,598 Views)

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
0 Kudos
Message 8 of 9
(3,585 Views)

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

0 Kudos
Message 9 of 9
(3,556 Views)