# LGF_MatrixTranspose (FC / 3.0.1)

Overview

Author: Siemens Digital Industry

## Short description

This function transposes a matrix of the data type `ARRAY[*,*] of LREAL`.

Condition: Input matrix (m x n) = output matrix (n x m).
A matrix is transposed by making columns out of the rows.

A = \begin{bmatrix} a_{11} & \cdots & a_{1n} \\ \vdots & \ddots & \vdots \\ a_{m1} & \cdots & a_{mn} \end{bmatrix} ; A^T = \begin{bmatrix} a_{11} & \cdots & a_{m1} \\ \vdots & \ddots & \vdots \\ a_{1n} & \cdots & a_{mn} \end{bmatrix}

Note
  Note that the number of rows of the input matrix must be equal to the number of columns of the output matrix. Also, the number of columns of the input matrix must be equal to the number of rows of the output matrix.

### Block Interface

| LGF_MatrixTranspose (FC) |
--- | --- | ---
|  |  |  |  | Ret_Val |  |  | Void
|  |  |  |  | error |  |  | Bool
|  |  |  |  | status |  |  | Word
Array[*, *] of LReal |  |  | matrix |  |  | Array[*, *] of LReal
Array[*, *] of LReal |  |  | matrixTranspose |  |  | Array[*, *] of LReal

### Output parameter

Identifier | Data type | Description
--- | --- | ---
Ret_Val | Void | Void - Function has no return value
error | Bool | FALSE: No error TRUE: An error occurred during the execution of the FB
status | Word | 16#0000-16#7FFF: Status of the FB 16#8000-16#FFFF: Error identification (see following Table)

### In/Out parameter

Identifier | Data type | Description
--- | --- | ---
matrix | Array[*, *] of LReal | Matrix to be transposed
matrixTranspose | Array[*, *] of LReal | Transposed matrix

### Status & Error codes

Code / Value | Identifier / Description
--- | ---
16#0000 | STATUS_NO_ERROR Execution finished without errors
16#8200 | ERR_MATR1_LOWBOUND_ROWS_RESMATR_LOWBOUND_COLUMNS Error: Matrix1 lower bound rows(Dim1) size is different with Result Matrix lower bound columns(Dim2)
16#8201 | ERR_MATR1_LOWBOUND_COLUMNS_RESMATR_LOWBOUND_ROWS Error: Matrix1 lower bound columns(Dim2) size is different with Result Matrix lower bound rows(Dim1)
16#8202 | ERR_MATR1_UPPBOUND_ROWS_RESMATR_UPPBOUND_COLUMNS Error: Matrix1 upper bound rows(Dim1) size is different with Result Matrix upper bound columns(Dim2)
16#8203 | ERR_MATR1_UPPBOUND_COLUMNS_RESMATR_UPPBOUND_ROWS Error: Matrix1 upper bound columns(Dim2) size is different with Result Matrix upperbound rows(Dim1)

## Change log

Version & Date | Change description
--- | ---
| 1.0.0 | Siemens Industry Online Support
| 19.08.2015 | First released version
| 1.0.1 | Siemens Industry Online Support
| 02.01.2017 | Upgrade: TIA Portal V14 Update 1
| 2.0.0 | Siemens Industry Online Support
| 06.02.2017 | Functionality using Array[*,*]
| 2.0.1 | Siemens Industry Online Support
| 17.08.2018 | Upgrade: TIA V15 Update 2
| 2.0.2 | Siemens Industry Online Support
| 23.11.2018 | Upgrade: TIA V15.1
| 2.0.7 | Simatic Systems Support
| 13.11.2019 | Regions, comments and constants are added Moved matrices to IO field.
| 3.0.0 | Simatic Systems Support
| 23.04.2020 | Set version to V3.0.0, harmonize the version of the whole library
| 3.0.1 | Simatic Systems Support
| 02.02.2020 | Insert documentation