LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple sheets from Excel into 2D array for graph

Solved!
Go to solution

I'll try to explain as clear as I can.

 

I'm reading data from an excel workbook with multiple sheets (a new sheet for every measurement), this happens with code in the picture in the opening post. Once I exit the for loop with my data it becomes a 3D array. I want to display this data in a graph or chart or whatever so I can compare the measurements but a graph/chart can't show data from a 3D array so I need to convert it to a 2D array.

0 Kudos
Message 11 of 19
(961 Views)

Hi,

I think Simyfren already mentioned the correct solution: use the index array function. I attached a simple LV 2013 example.

 

 

 

0 Kudos
Message 12 of 19
(955 Views)

Hi,

 

I know how to read the 3D array with an index function, but I want to put all the data from the 3D array into one 2D array, reading the different pages is not what I need.

0 Kudos
Message 13 of 19
(949 Views)

Hi,

Sorry, I misunderstood. You could do that like this (I right-clicked the Build Array function and selected Concatenate Inputs):

 

Concatenate Inputs.PNG

0 Kudos
Message 14 of 19
(943 Views)

That's almost how I'd like it, and that's where I wanted to use the Insert into Array VI. I would like to add the different pages in new columns, instead of rows. First of all: is that possible without using Insert into Array? Because I still get the same error with that VI.

0 Kudos
Message 15 of 19
(940 Views)

Hi,

That could be solved by transposing the array. I used the transpose twice to keep the rows ordered as in the original 3D array. I changed the initial 3D array to better show why the first transpose is needed.

 

3D to 2D.PNG

Message 16 of 19
(927 Views)

Transposing twice didn't came up in my mind, looks good! 

 

Except, when I try to implement this in my own pogram and I go into the 2nd for loop where the 3D array is indexed, the 3D array becomes a 2D array and I can't find the problem here.. Please see attached images.

 

error1.pngerror2.png

 

 

 

 

 

*************

Well I've solved that part by right clicking the tunnel and disabling indexing. Next problem appeared when build the array in the last for loop, it creates a 3D array instead of a 2D array.. It might be very easy, but I'm not that experienced with LabView..

0 Kudos
Message 17 of 19
(924 Views)
Solution
Accepted by Jakhals

I forgot to look at where you are coming from. The 3rd dimension is created by the FOR loop that reads the excel file. That can be prevented: if you right-click the output tunnel of that loop, you can choose Tunnel Mode>Concatenating. You will get a 2D array out. You still need to transpose, but an additional FOR loop is not needed here. I made 2 examples, one with and one without transposing:

 

2D concatenating tunnel.PNG 

Message 18 of 19
(909 Views)

Sweet, a solution and I've learned some new stuff with the tunnels etc. Thanks!

0 Kudos
Message 19 of 19
(905 Views)