Build Matrix

Appends elements to a matrix by rows or columns.

Programming Patterns

To add one or more elements to a matrix at a specific location, use Set Matrix Elements. To add a submatrix to a matrix at a specific location, use Set Submatrix.

connector_pane_image
datatype_icon

element

Numeric scalar or a 1D or 2D array of any numeric type.

To add additional element inputs, resize the node.

datatype_icon

appended matrix

The resulting matrix.

Appending by Rows or Columns

Build Matrix has two modes: Append by columns or Append by rows. The default mode is Append by columns.

Right-click the node and select Build matrix mode » Append by rows to add a new element or matrix to the last row starting in the first column. Right-click the node and select Build matrix mode » Append by columns to add a new element or matrix to the last column starting in the first row.

Wiring Empty Input Values

If element is an empty array, this node ignores the empty dimensions.

Wiring Inputs of Different Numeric Types or Dimensions

The dimensions and data type of appended matrix match those of the element input with the highest dimension and most precise data type. For example, if you wire a 1D array of numeric double to element 0 and a 2D array of complex double to element 1, additional inputs and outputs default or coerce to 2D arrays of complex double.

When you wire inputs with different dimensions to Build Matrix, this node creates appended matrix by padding the smaller input with the scalar default value (0).