LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert 2D Array in 2D Array

okay... I have the following case:

 

I have a 2 inputs which are both arrays of numeric datatypes. Both arrays can have a different number of rows, only the amount of columns is the same.

 

For example:

 

array1: [[1,2]]

array2: [[3,4],[5,6]]

 

output array: [[1,2,3,4],[,,5,6]]

 

How do i achieve this? I have now a rather complex solution and think it must be possible that it can be done easier.

0 Kudos
Message 1 of 3
(2,286 Views)

I am not sure I understand what you want.

 

In LV an array cannot have columns with different numbers of rows.  [,,5,6] does not represent a valid LV array row or column.  LV will fill it in with the default value for the datatype, in this case 0, giving [0,0,5,6].

 

Please post your VI.  Show the typical inputs and what you want the output to be.  When you get that data on the front panel, Make Current Values Default and Save.  Then post that VI.

 

Lynn

0 Kudos
Message 2 of 3
(2,278 Views)

Two simple choices:  Build Array or Build Matrix.  For appending rows you can simply use Build Array with concatenate inputs selected.  For 2D scalars you can use Build Matrix and then have the option to append rows or columns.  Ignore the red coercion dot,  Array to Matrix is just a simple VI whose only purpose is to hide the dot so I tend to skip it.

 

Build2DArray.png

 

I am guessing that you want the Append Cols output, if the default values of zero cause problems, well, then you are probably in for a bit of a complex solution.

Message 3 of 3
(2,271 Views)