addts

Adds a timeseries object as a member of a tscollection.

Category: Language Fundamentals > Data Types

Syntax

tc = addts(tc, ts)

Adds the series ts to the collection tc.

Description

A collection groups series measured at the same times. The new member is stored under its Name, and you can then reach it as a field, as in tc.b. A series with a different time vector must be resampled first.

Input arguments

tc
A tscollection object.
ts
A timeseries with a name and a time vector equal to that of the collection.

Output arguments

tc
The collection including the new member.

Example

Add a second series

tc = tscollection(timeseries([1 2 3]', [0 1 2], 'Name', 'a'));
t2 = timeseries([4 5 6]', [0 1 2], 'Name', 'b');
tc = addts(tc, t2);
gettimeseriesnames(tc)
Output
ans = 1×2 cell

    {'a'}    {'b'}

Notes

In MatLivre only the form that takes a timeseries object works; the form with raw data and a name is not supported.

See also

tscollection addsampletocollection gettimeseriesnames timeseries