LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a 3D Array

Solved!
Go to solution

Hi, I am trying to create a 744x2 array from two 2D arrays created from two spreadsheet files, loaded as text files. I can output separate 2D, 744x1, arrays for both, however, I am unable to merge the the two together to create two columns. Only one column is shown. 

Any help would be appreciated.

0 Kudos
Message 1 of 7
(3,176 Views)

So you are creating a 3D array, but you actually want a 2-D array?

 

Use index Array to get the 0th column on your two 2-D arrays.  Then use Build Array to concatenate the resulting two 1-D arrays into a 2-D array.

0 Kudos
Message 2 of 7
(3,163 Views)

Thanks for the reply. That is correct, the resultant array should be 2D, not 3D. I believe I've followed your instructions however, the resultant array is now 1D. 

0 Kudos
Message 3 of 7
(3,154 Views)
Solution
Accepted by topic author LabVIEWnovice99

Hi novice,

 


@LabVIEWnovice99 wrote:

I am unable to merge the the two together to create two columns.


When you need columns after "merging" (aka building an array rowwise) you need to transpose the 2D array:

Why do you read your spreadsheet files as strings when you convert them to numeric data anyway? Just read them using the "DBL" version of ReadDelimitedSpreadsheetFile!

 

What's the point of indexing single elements from your arrays in the last message?

 

It seems you really should take all those "Training resources" as offered in the header of the LabVIEW board!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(3,151 Views)

That's brilliant, thank you.

0 Kudos
Message 5 of 7
(3,145 Views)

@LabVIEWnovice99 wrote:

Thanks for the reply. That is correct, the resultant array should be 2D, not 3D. I believe I've followed your instructions however, the resultant array is now 1D. 


Because you used Index Array to grab a single element, not a single column!

 

Put a zero in the column index input and nothing wired to the row index input.  Then you get the entire 0th column.

0 Kudos
Message 6 of 7
(3,123 Views)

First of all, your files only have one column, so you should get the 1D output instead. (If you transpose=T you get the first column instead of row). If you don't really need the strings, you can even get the DBL directly. Now just built it onto a 2D array and transpose if desired.

 

altenbach_1-1612207813714.png

 

 

0 Kudos
Message 7 of 7
(3,074 Views)