Main Content

addts

Add timeseries to tscollection

Description

example

tscout = addts(tscin,ts) adds a timeseries object ts to the tscollection object tscin. The input timeseries can be a single timeseries object or a cell array of timeseries objects.

tscout = addts(tscin,ts,tsname) specifies the names of the input timeseries objects. tsname can be a single character vector or a cell array of character vectors defining the names for each timeseries in ts.

tscout = addts(tscin,tsdata,tsname) adds a timeseries object with data tsdata and name tsname to the input tscollection.

Examples

collapse all

Create a tscollection object containing one timeseries object. Then, add a second timeseries to the collection.

ts1 = timeseries([1.1 2.9 3.7 4.0 3.0]',1:5,...
                 'Name','Acceleration');
ts2 = timeseries([3.2 4.2 6.2 8.5 1.1]',1:5,...
                 'Name','Speed');
tscin = tscollection(ts1);
tscout = addts(tscin,ts2)
Time Series Collection Object: unnamed

Time vector characteristics

      Start time            1 seconds
      End time              5 seconds

Member Time Series Objects:

      Acceleration
      Speed

Input Arguments

collapse all

Input tscollection, specified as a scalar.

Input timeseries, specified as a scalar timeseries object or a cell array of timeseries objects.

timeseries name, specified as a character vector or a cell array of character vectors.

timeseries data, specified as a numeric or logical scalar, vector, or multidimensional array.

Data Types: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Tips

  • The timeseries objects that you add to the collection must have the same time vector as the collection. That is, the time vectors must have the same time values and units.

  • Suppose that the time vector of a timeseries object is associated with calendar dates. When you add the timeseries to a collection with a time vector without calendar dates, the time vectors are compared based on the units and the values relative to the StartDate property.

Introduced before R2006a