pagetranspose

Transposes each page of an N-D array.

Category: Language Fundamentals > Operators and Elementary Operations

Syntax

B = pagetranspose(A)

Swaps the first two dimensions of A, page by page.

Description

A 3-D array can be viewed as a stack of matrices. pagetranspose transposes every matrix in the stack with one call, equivalent to permute(A, [2 1 3:ndims(A)]), without writing a loop over pages.

For conjugate transposes of complex pages use pagectranspose.

Input arguments

A
Array with 2 or more dimensions. Pages are the 2-D slices A(:,:,k).

Output arguments

B
Array of size [n m p ...] for an input of size [m n p ...], with no conjugation.

Example

A = cat(3, [1 2 3; 4 5 6], [7 8 9; 10 11 12]);
B = pagetranspose(A);
size(B)
B(:, :, 2)
Output
ans = 1×3

     3     2     2
ans = 3×2

     7    10
     8    11
     9    12

See also

pagectranspose pagemtimes permute transpose