Extract Diagonal

Extract main diagonal of input matrix


Math Functions / Matrices and Linear Algebra / Matrix Operations



The Extract Diagonal block populates the unoriented output vector with the elements on the main diagonal of the M-by-N input matrix A.

D = diag(A)					Equivalent MATLAB code

The output vector has length min(M,N).

Dialog Box

Supported Data Types

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed and unsigned)

  • Boolean — Block outputs are always Boolean.

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

See Also

Constant Diagonal MatrixDSP System Toolbox
Create Diagonal MatrixDSP System Toolbox
Extract Triangular MatrixDSP System Toolbox

Was this topic helpful?