combvec
创建向量的所有组合
说明
示例
使用 combvec
函数生成向量的所有组合
此示例说明如何生成一个包含两个矩阵 a1
和 a2
的所有组合的矩阵。
创建两个输入矩阵,即 a1
和 a2
。然后调用 combvec
函数来生成所有可能的组合。
a1 = [1 2 3; 4 5 6]; a2 = [7 8; 9 10]; a3 = combvec(a1,a2)
a3 = 1 2 3 1 2 3 4 5 6 4 5 6 7 7 7 8 8 8 9 9 9 10 10 10
输入参数
A1
— 输入矩阵 1
矩阵
要计算其所有组合的输入矩阵,指定为具有 N1
个列向量的矩阵。
A2
— 输入矩阵 2
矩阵
要计算其所有组合的输入矩阵,指定为具有 N2
个列向量的矩阵。
输出参量
A
— 输出矩阵
矩阵
输出矩阵,返回为一个包含 (N1*N2*...)
个列向量的矩阵,其中的列由每个输入 Ai
的列向量的所有组合构成。
版本历史记录
在 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)