Transpose Pages of N-D Array
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,2*r,3*r)
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 = pagetranspose(A)
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
X — Input array
Input array, specified as a multidimensional array.
Complex Number Support: Yes
Page-wise functions like
pagetranspose operate on 2-D
matrices that have been arranged into a multidimensional array. For example, with a 3-D
array the elements in the third dimension of the array are commonly called
pages because they stack on top of each other like pages in a
book. Each page is a matrix that gets operated on by the function.
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 gets operated on, such as
The page-wise transpose is equivalent to permuting the first two dimensions of the array with
permute(X,[2 1 3:ndims(X)]).
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).