Documentation Center

  • Trial Software
  • Product Updates

Extract Diagonal

Extract main diagonal of input matrix

Library

Math Functions / Matrices and Linear Algebra / Matrix Operations

dspmtrx3

Description

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
diagMATLAB

Was this topic helpful?