Create a table containing all element combinations
t = combinations(v1, ..., vn)
t = combinations(v1, .., vn) creates a table containing all element combinations
of inputs v1, .., vn, where v1, ..., vn can be of different type and size.
The properties of t are as follows:
Its number of rows is equal to number of combinations (product of the number of elements of each input).
Its number of columns/variables corresponds to number of input arguments (v1, ..., vn)
The data type of each column/variable matches to the data type of each input.
Combinations of two vectors of doubles
Combinations of vectors/matrix
v1 = [1; 2; 3]; v2 = [4 5]; c = combinations(v1, v2) v3 = [1; 7; 4]; v4 = [8 5; 2 6]; v5 = [0 1]; c = combinations(v3, v4, v5) | ![]() | ![]() |
Combinations of vectors of different types
| Version | Description |
| 2025.1.0 | Introduction in Scilab. |