Concatenate Multiple Arrays in LabVIEW

Updated May 24, 2018

Reported In

Software

  • LabVIEW Base
  • LabVIEW Full
  • LabVIEW Professional

Issue Details

I have multiple different arrays that I need to combine or concatenate in LabVIEW. Some of the arrays have different dimensions.

Solution

One way of concatenating multiple arrays is by using Build Array function. This function works in two modes: either appending elements to an n-dimensional array, which is the default mode, or concatenating multiple arrays. The Build Array function will work in concatenate mode when Concatenate Inputs has been selected from the shortcut menu. You can access the shortcut menu by right clicking on the VI.
 


 

The following code segment demonstrates the difference between the output from the build array function before and after you switch it to Concatenate Inputs. The first image below shows the code, the second shows the corresponding result on the front panel.

 


If you have a multi-dimensional array and want to convert it into a one dimensional array, then you need to use a Reshape Array function, which will take the sum of all the elements as the dimension size input. 

Another way of building a custom, one dimensional array from multiple arrays is by using the Insert Into Array function. When you wire an array to this function, the function resizes automatically to display index inputs for each dimension in the array. If you do not wire any index inputs, the function appends the new element or subarray to the end of the n-dim array.

Additional Information

The Build Array function may output a transposed array depending on the inputs. If necessary, Transpose 2D Array function can be used to rearrange the array elements.

WAS THIS ARTICLE HELPFUL?

Not Helpful