<< table2struct Timeseries/Table timeseries >>

Scilab Help >> Spreadsheet > Timeseries/Table > table2timeseries

table2timeseries

convert a table into a timeseries

Syntax

ts = table2timeseries(t)

ts = table2timeseries(t, "RowTimes", time)

ts = table2timeseries(t, "SampleRate", sampleRate)
ts = table2timeseries(t, "TimeStep", timeStep)
ts = table2timeseries(t, "SampleRate", sampleRate, "StartTime", t0)
ts = table2timeseries(t, "TimeStep", timeStep, "StartTime", t0)

Arguments

t

table object

time

time vector or variable name of table

duration or datetime column vector or string

timeStep

time step, duration or calendarDuration value

sampleRate

number of samples per second (Hz), real scalar

t0

start time, duration or datetime value

ts

timeseries object

Description

table2timeseries converts a table into a timeseries. The table must have a duration or datetime variable.

If the table has multiple duration and datetime variables, the first variable becomes the row times of timeseries. It is also possible to specify the name of the variable which will become the rowtimes of the timeseries, thanks to 'RowTimes'.

If the table does not contain any time variable, you must use: 'RowTimes', 'TimeStep' or 'SampleRate':

To define the first row time, you must use 'StartTime'.

For more information, see timeseries.

Examples

ts = table2timeseries(t)

Time = datetime(2023, 6, 1:3)';
A = [1; 2; 3];
B = [10; 20; 30];
C = [-10;-20;-30];
t = table(Time, A, B, C, "VariableNames", ["Time", "A", "B", "C"]);
ts = table2timeseries(t)

ts = table2timeseries(t, "RowTimes", time) where time is a variable name

Time = datetime(2023, 6, 1:3)';
A = [1; 2; 3];
B = [10; 20; 30];
C = [-10;-20;-30];
Hours = hours(1:3)';
t = table(Time, A, B, C, Hours, "VariableNames", ["Time", "A", "B", "C", "Hours"]);
ts = table2timeseries(t, "RowTimes", "Hours")

ts = table2timeseries(t, "RowTimes", time) where time is a datetime vector

Time = datetime(2023, 6, 1:3)';
A = [1; 2; 3];
B = [10; 20; 30];
C = [-10;-20;-30];
t = table(A, B, C, "VariableNames", ["A", "B", "C"]);
ts = table2timeseries(t, "RowTimes", Time)

ts = table2timeseries(t, "TimeStep", time)

A = [1; 2; 3];
B = [10; 20; 30];
C = [-10;-20;-30];
t = table(A, B, C, "VariableNames", ["A", "B", "C"]);
ts = table2timeseries(t, "TimeStep", hours(1))

ts = table2timeseries(t, "SampleRate", time)

A = [1; 2; 3];
B = [10; 20; 30];
C = [-10;-20;-30];
t = table(A, B, C, "VariableNames", ["A", "B", "C"]);
ts = table2timeseries(t, "SampleRate", 0.05)

See also

History

VersionDescription
2024.0.0 Introduction in Scilab.

Report an issue
<< table2struct Timeseries/Table timeseries >>