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


readtimeseries

create a timeseries from a file

Syntax

ts = readtimeseries(filename)
ts = readtimeseries(filename, opts)
ts = readtimeseries(..., Name, Value)

Arguments

filename

name of file to read

opts

file import options obtained by detectImportOptions

Name, Value

Name: 'VariableNames', Value: vector of strings: extracts from the file only the data corresponding to the entered variable names.

Name: 'RowTimes', Value: duration or datetime column vector: if the filename has no time, use this property to add a time index in the timeseries.

Name: 'StartTime', duration or datetime value: pecifies the start time of the timeseries.

Name: 'TimeStep', Value: duration or calendarDuration value: time step.

Name: 'SampleRate', Value: real scalar: number of samples per second (Hz).

ts

timeseries object.

Description

The readtimeseries function creates a timeseries from a file. Each column of file is stored in variables. If however the columns have no name, then the default variable names are used (["Time", "Var1", ..., "VarN"]). Accepted file formats are .txt, .dat or .csv.

readtimeseries detects the format file thanks to detectImportOptions function. opts contains all information on the file.

To extract only the necessary variables (columns), use ts = readtimeseries(filename, "VariableNames", value).

Examples

dt = [datetime(2022,1,10):caldays(1):datetime(2022,1,21)]';
hc = [13574; 13169; 11999; 12146; 15456; 10545; 11091; 21657; 11393; 10283; 10924; 16208];
hp = [13593; 15306; 16766; 15941; 14558; 13722; 18401; 14632; 14571; 14925; 14284; 15028];
ts = timeseries(dt, hc, hp, "VariableNames", ["Time", "HC", "HP"]);
writetimeseries(ts, fullfile(TMPDIR, "data.txt"));

r = readtimeseries(fullfile(TMPDIR, "data.txt"));

See also

History

VersionDescription
2024.0.0 Introduction in Scilab.
Report an issue
<< readtable Timeseries/Table retime >>

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