Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

combvec

Create all combinations of vectors

Syntax

combvec(A1,A2,...)

Description

combvec(A1,A2,...) takes any number of inputs,

A1

Matrix of N1 (column) vectors

A2

Matrix of N2 (column) vectors

and returns a matrix of (N1*N2*...) column vectors, where the columns consist of all possibilities of A2 vectors, appended to A1 vectors.

Examples

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

Introduced before R2006a

Was this topic helpful?