Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - English


matrix2table

convert a matrix into a table

Syntax

t = matrix2table(m)
t = matrix2table(m, Name, Value)

Arguments

m

double, boolean, string, datetime or duration matrix

Name, Value

Name: 'VariableNames', Value: vector of strings: the variable name of each column of t. The variable names must be unique and their number must be equal to size(m, 2). Default value: ["Var1", ..., "VarN"].

Name: 'RowNames', Value: vector of string: the row names for t. The names must be unique and their number must be equal to size(m, 1). Default value: [].

t

table object

Description

matrix2table converts a matrix into a table. The table has the same size of matrix. Each column of m becomes a variable in t.

Like table function, you can specify the variable and row names thanks to optional parameters.

You can use directly t = table(m).

Examples

t = matrix2table(m)

m = [1 2 3; 4 5 6; 7 8 9]
t = matrix2table(m)
// or table(m)

m = ["a" "b"; "c" "d"]
t = matrix2table(m)

t = matrix2table(m, "VariableNames", ["Var1", ..., "VarN"])

m = [1 2 3; 4 5 6; 7 8 9]
t = matrix2table(m, "VariableNames", ["c1", "c2", "c3"])
// or table(m, "VariableNames", ["c1", "c2", "c3"])

t = matrix2table(m, "RowNames", val)

m = [1 2 3; 4 5 6; 7 8 9]
x = ["a"; "b"; "c"]
t = matrix2table(m, "VariableNames", ["c1", "c2", "c3"], "RowNames", x)
// or table(m, "VariableNames", ["c1", "c2", "c3"], "RowNames", x)

See also

  • table — create a table from variables
  • table2matrix — convert a table into a matrix

History

VersionDescription
2024.0.0 Introduction in Scilab.
Report an issue
<< isregular Timeseries/Table pivot >>

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 Oct 24 11:13:15 CEST 2024