pagetranspose - Page-wise transpose - MATLAB (original) (raw)
Main Content
Page-wise transpose
Since R2020b
Syntax
Description
Y = pagetranspose([X](#mw%5F93553ba9-1362-4b4a-95e5-eea08c7f8c92))
applies the nonconjugate transpose to each page of N-D array X
. Each page of the outputY(:,:,i)
is found by transposing the corresponding page inX
, as in X(:,:,i).'
.
Examples
Create a 3-D array A
, and then use pagetranspose
to transpose each page of the array.
r = repelem(1:3,3,1); A = cat(3,r,2r,3r)
A = A(:,:,1) =
1 2 3
1 2 3
1 2 3
A(:,:,2) =
2 4 6
2 4 6
2 4 6
A(:,:,3) =
3 6 9
3 6 9
3 6 9
B = B(:,:,1) =
1 1 1
2 2 2
3 3 3
B(:,:,2) =
2 2 2
4 4 4
6 6 6
B(:,:,3) =
3 3 3
6 6 6
9 9 9
Input Arguments
Input array, specified as a multidimensional array.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
| char
| string
| struct
| cell
| categorical
| datetime
| duration
| calendarDuration
Complex Number Support: Yes
More About
Page-wise functions like pagetranspose
operate on 2-D matrices that have been arranged into a multidimensional array. For example, the elements in the third dimension of a 3-D array are commonly called pages because they stack on top of each other like pages in a book. Each page is a matrix that the function operates on.
You can also assemble a collection of 2-D matrices into a higher dimensional array, like a 4-D or 5-D array, and in these cases pagetranspose
still treats the fundamental unit of the array as a 2-D matrix that the function operates on, such asX(:,:,i,j,k,l)
.
The cat function is useful for assembling a collection of matrices into a multidimensional array, and the zeros function is useful for preallocating a multidimensional array.
Tips
- The page-wise transpose is equivalent to permuting the first two dimensions of the array with
permute(X,[2 1 3:ndims(X)])
.
Extended Capabilities
Usage notes and limitations:
- Code generation does not support cell arrays for this function.
The pagetranspose
function fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray (Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced in R2020b