transpose

Transposes a matrix, function form of the .' operator.

Category: Language Fundamentals > Matrices and Arrays

Syntax

B = transpose(A)

Swaps rows and columns of A. Same as A.'.

Description

The transpose is purely a rearrangement, so complex values are not conjugated. To get the conjugate transpose use ctranspose or the ' operator.

Transposing a row vector gives a column vector and vice versa. Arrays with more than two dimensions are an error; use pagetranspose or permute for those.

Input arguments

A
2-D array of any type.

Output arguments

B
The transpose: element B(j,i) equals A(i,j).

Example

A = [1 2 3; 4 5 6];
transpose(A)
z = [1+2i 3-1i];
transpose(z)
Output
ans = 3×2

     1     4
     2     5
     3     6
ans = 2×1 complex

   1.0000 + 2.0000i
   3.0000 - 1.0000i

See also

.' ' pagetranspose permute