Get Matrix Elements
- Updated2023-02-17
- 3 minute(s) read
Get Matrix Elements
Returns the elements of matrix beginning at index (row), index (col).
Programming Patterns
If you wire scalar values i, j to index (row) and index (col), respectively, this node returns a scalar that contains the element at location (i, j).


matrix
2D array of any numeric type.

index (row)
Integer, floating-point numeric, 1D array of integers, or 1D array of a floating-point numeric.
To add additional index (row) inputs, resize the node.
Default: 0

index (col)
Integer, floating-point numeric, 1D array of integers, or 1D array of a floating-point numeric.
To add additional index (col) inputs, resize the node.
Default: 0

output matrix
Scalar or 2D array that contains the matrix elements. The data type of output matrix is the same as the data type of matrix.
To add additional output matrix outputs, resize the node.
Output Behavior with 1D Arrays
If you wire a 1D array of numeric data to index (row) or index (col), this node returns one matrix element for each location specified. To determine these locations this node pairs each row index in index (row) with each column index in index (col). For example, if you pass the array of integers {1, 2, 4} to index (row) and the integer {5} to index (col), this node retrieves matrix elements at indexes (1, 5), (2, 5), and (4, 5). In this case, the output is a column vector, or 3 x 1 matrix.
Leaving Inputs Empty or Unwired
If you leave certain inputs empty or unwired, this node returns a portion of matrix or invalid operations as described in the following table.
| Input | Result |
|---|---|
| You wire an empty matrix to matrix. | output matrix returns an invalid operation value at each exterior location. |
| You wire an empty 1D array to index (row) or index (col). | output matrix returns an empty matrix with 0 in the corresponding row or column dimension. |
| You do not wire index (row) and index (col). | output matrix returns a column vector with the first column of matrix. |