combinations
Create a table containing all element combinations
Syntax
t = combinations(v1, ..., vn)
Description
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.
Examples
Combinations of two vectors of doubles
v1 = [1; 2; 3]; v2 = [4; 5]; c = combinations(v1, v2)
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
See also
History
Version | Description |
2025.1.0 | Introduction in Scilab. |
Report an issue | ||
<< cell2table | Timeseries/Table | detectImportOptions >> |