Matrix – Create diagonal matrix

This function block creates a diagonal matrix out of the input vector VX.

A diagonal matrix is a square matrix in which only the elements of the main diagonal may have non zero values, every other element is 0. The diagonal matrix will either be written to the input MX or a new matrix will be created at output MY.

No designated output matrix (default):

The result will be written back to the additional in-/output matrix MX. No new matrix will be created. The output MY will not be available. The provided matrix MX has to be large enough to hold the diagonal matrix created out of VX. If this is not the case the download will be aborted with an error message.

With designated output matrix:

A new matrix will be created on MY. The dimension of this matrix will be determined automatically out of the input vector. The input MX is not available.



The parameter dialog can be used to select the way how to provide the created diagonal matrix.


Name I/O Type(s) Function
VX I Data type independent Input vector
MX I/O Data type independent In-/output vector
MY O Data type independent Output vector


If the input signals are connected incorrectly, the symbol will be depicted red in run mode.


The data type can be assigned by connecting an input signal.