ipermute
逆置换数组维度。
说明
示例
三维数组
创建一个 4×3×2 数组 B
,并根据维度顺序 [3 1 2]
计算其逆置换。
rng default
B = rand(4,3,2)
B = B(:,:,1) = 0.8147 0.6324 0.9575 0.9058 0.0975 0.9649 0.1270 0.2785 0.1576 0.9134 0.5469 0.9706 B(:,:,2) = 0.9572 0.4218 0.6557 0.4854 0.9157 0.0357 0.8003 0.7922 0.8491 0.1419 0.9595 0.9340
A = ipermute(B,[3 1 2])
A = A(:,:,1) = 0.8147 0.9572 0.6324 0.4218 0.9575 0.6557 A(:,:,2) = 0.9058 0.4854 0.0975 0.9157 0.9649 0.0357 A(:,:,3) = 0.1270 0.8003 0.2785 0.7922 0.1576 0.8491 A(:,:,4) = 0.9134 0.1419 0.5469 0.9595 0.9706 0.9340
逆置换 A
是满足如下条件的数组:当您使用相同的维度顺序对其进行置换时,结果等于原始数组 B
。
C = permute(A,[3 1 2])
C = C(:,:,1) = 0.8147 0.6324 0.9575 0.9058 0.0975 0.9649 0.1270 0.2785 0.1576 0.9134 0.5469 0.9706 C(:,:,2) = 0.9572 0.4218 0.6557 0.4854 0.9157 0.0357 0.8003 0.7922 0.8491 0.1419 0.9595 0.9340
输入参数
B
— 输入数组
向量 | 矩阵 | 多维数组
输入数组,指定为向量、矩阵或多维数组。
dimorder
— 维度顺序
行向量
维度顺序,指定为行向量,包含表示输入数组维度的唯一正整数元素。
扩展功能
tall 数组
对行数太多而无法放入内存的数组进行计算。
C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。
用法说明和限制:
第一个参数不支持元胞数组。
请参阅Variable-Sizing Restrictions for Code Generation of Toolbox Functions (MATLAB Coder)。
基于线程的环境
使用 MATLAB® backgroundPool
在后台运行代码或使用 Parallel Computing Toolbox™ ThreadPool
加快代码运行速度。
此函数完全支持基于线程的环境。有关详细信息,请参阅在基于线程的环境中运行 MATLAB 函数。
GPU 数组
通过使用 Parallel Computing Toolbox™ 在图形处理单元 (GPU) 上运行来加快代码执行。
此函数完全支持 GPU 数组。有关详细信息,请参阅Run MATLAB Functions on a GPU (Parallel Computing Toolbox)。
分布式数组
使用 Parallel Computing Toolbox™ 在集群的组合内存中对大型数组进行分区。
此函数完全支持分布式数组。有关详细信息,请参阅Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox)。
版本历史记录
在 R2006a 之前推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)