ts2timetable

Converts a timeseries object into a timetable.

Category: Other public functions: datatypes

Syntax

TT = ts2timetable(ts)

Returns a timetable whose rows are the samples of ts.

Description

timeseries objects are the older container for time-stamped data, while timetable is the table-based one that works with retime, synchronize and most newer functions. This conversion lets old data enter the newer workflow. Numeric times become durations in seconds; datetime times give a datetime row axis.

Input arguments

ts
A timeseries object.

Output arguments

TT
A timetable. The sample times become the row times and the data go into the variable Data.

Example

From timeseries

ts = timeseries([10; 20; 30], [0 1 2]);
TT = ts2timetable(ts)
Output
TT = 3×1 timetable

    Time     Data
    _____    ____

    0 sec     10 
    1 sec     20 
    2 sec     30

See also

timeseries timetable retime table2timetable