Get Matrix Diagonal
- Updated2023-02-17
- 2 minute(s) read
Get Matrix Diagonal
Returns the diagonal of matrix beginning at index (row), index (column).


matrix
2D array of any numeric type.

index (row)
Starting row index in the output.
Can be an integer or real number.
To add additional index (row) inputs, resize the node.
Default: 0

index (col)
Starting column index in the output.
Can be an integer or real number.
To add additional index (col) inputs, resize the node.
Default: 0

diagonal
2D array with one column that contains the diagonal elements in matrix. The data type of diagonal is the same as the data type of matrix.
To add additional diagonal outputs, resize the node.
Extracting Subdiagonals
This node returns a portion of the diagonal, known as a subdiagonal, in certain cases. This node returns subdiagonals as described in the following table.
| Input | Result |
|---|---|
| You wire positive values to index (row) and index (col) that are less than the row and column dimensions of matrix. | This node returns a subdiagonal that includes the diagonal elements starting at (index (row), index (col)) and ending at the last element of the diagonal. |
| You wire a positive value to index (row) that is less than index (col). | diagonal returns a portion of the upper diagonal. |
| You wire a positive value to index (row) that is greater than index (col). | diagonal returns a portion of the lower diagonal. |
| You wire equal values to index (row) and index (col). | diagonal returns a portion of the main diagonal. |