02-01-2021 08:42 AM
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.
Solved! Go to Solution.
02-01-2021 08:59 AM
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.
02-01-2021 09:20 AM
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.
02-01-2021 09:23 AM - edited 02-01-2021 09:24 AM
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!
02-01-2021 09:32 AM
That's brilliant, thank you.
02-01-2021 10:25 AM
@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.
02-01-2021 01:45 PM - edited 02-01-2021 01:45 PM
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.