Build Array

Concatenates multiple arrays or appends elements to an n-dimensional array. The connector pane displays the default data types for this polymorphic function. Details

array or element can be any n-dimensional array or scalar element. All inputs must be either elements and 1D arrays or n-dimensional and (n-1)-dimensional arrays. All inputs must have the same base type.
appended array is the resulting array.

Build Array Details

When you place the function on the block diagram, it has only one input available. Add inputs to the node by right-clicking an input and selecting Add Input from the shortcut menu or by resizing the node.

Build Array operates in one of two modes depending on whether you select the Concatenate Inputs option. If you select the Concatenate Inputs option, the function appends all inputs in order, forming an output array of the same dimensionality as the highest-dimension array input wired. If you do not select the Concatenate Inputs option, the function builds an output array of one dimension higher than the dimension of the inputs. The inputs must all be the same dimensionality. The function appends each input in order, forming a subarray, element, row, or page, of the output array. Inputs are padded, as necessary, to match the size of the longest input.

For example, if you wire two 1D arrays, {1, 2} and {3, 4, 5} to Build Array, and select Concatenate Inputs, the output is the 1D array {1, 2, 3, 4, 5}. If you wire the same two arrays to Build Array, and do not select Concatenate Inputs, the output is a 2D array containing {{1, 2, 0}, {3, 4, 5}}, where the first input is padded to match the length of the second input.

If the inputs are all arrays of the same dimensionality, right-click the function to select or deselect the Concatenate Inputs option. If the inputs do not have the same dimensionality, Concatenate Inputs is automatically selected and cannot be deselected. If all the inputs are scalar elements, Concatenate Inputs is automatically deselected and cannot be selected, and the output is a 1D array containing the elements in order.

When you select Concatenate Inputs, the glyphs in the Build Array icon will change to distinguish between the two input types. Inputs with the same dimensionality as the output will show an array glyph, while inputs with a dimensionality that is one less than the output will show an element glyph.