Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.1.0 - 日本語


combinations

Create a table containing all element combinations

Syntax

t = combinations(v1, ..., vn)

Arguments

v1, ..., vn

double, string, boolean, datetime or duration matrix

t

A table

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

a = ["A"; "B"; "C"];
d = 0:2;
b = [%t; %f];

cc = combinations(a, d, b)

dt = [datetime("yesterday"); datetime("today"); datetime("tomorrow")];
dura = hours(0:10:24);
cc2 = combinations(dt, dura)

See also

  • table — create a table from variables
  • ndgrid — build matrices or N-D arrays by replicating some template vectors

History

バージョン記述
2025.1.0 Introduction in Scilab.
Report an issue
<< cell2table Timeseries/Table detectImportOptions >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu May 22 12:57:16 CEST 2025