tscollection

Create tscollection object

Syntax

tsc = tscollection(TimeSeries)
tsc = tscollection(Time)
tsc = tscollection(...,'Parameter',Value,...)

Description

tsc = tscollection(TimeSeries) creates a tscollection object tsc with one or more timeseries objects already in the MATLAB® workspace. The argument TimeSeries can be a

  • Single timeseries object

  • Cell array of timeseries objects

tsc = tscollection(Time) creates an empty tscollection object with the time vector Time. When time values are date strings, you must specify Time as a cell array of date strings.

tsc = tscollection(...,'Parameter',Value,...) creates a tscollection object with optional parameter-value pairs you enter after specifying either a time vector or a timeseries object. You can specify the following parameter:

  • Name — String that specifies the name of this tscollection object

Examples

The following example shows how to create a tscollection object.

  1. Import the sample data.

    load count.dat
    
  2. Create three timeseries objects to store each set of data:

    count1 = timeseries(count(:,1),1:24,'name', 'ts1');
    count2 = timeseries(count(:,2),1:24,'name', 'ts2');
    count3 = timeseries(count(:,3),1:24,'name', 'ts3');
  3. Create a tscollection object named tsc and add to it two out of three time series already in the MATLAB workspace, by using the following syntax:

    tsc = tscollection({count1 count2},'name','tsc')
    

More About

expand all

Tips

Definition: Time Series Collection

A time series collection object is a MATLAB variable that groups several time series with a common time vector. The time series that you include in the collection are called members of this collection.

Properties of Time Series Collection Objects

This table lists the properties of the tscollection object. You can specify the Time, TimeSeries, and Name properties as input arguments in the constructor.

Property

Description

Name

tscollection name as a string. This can differ from the tscollection name in the MATLAB workspace.

Time

When TimeInfo.StartDate is empty, values are measured relative to 0 . When TimeInfo.StartDate is defined, values represent date strings measured relative to the StartDate.

The length of Time must be the same as the first or the last dimension of Data for each collection .

TimeInfo

Contains fields for contextual information about Time:

  • Units — Time units with any of the following values: 'weeks', 'days', 'hours', 'minutes', 'seconds', 'milliseconds', 'microseconds', 'nanoseconds'

  • Start — Start time

  • End — End time (read only)

  • Increment — Interval between subsequent time values. NaN when times are not uniformly sampled.

  • Length — Length of the time vector (read only)

  • Format — String defining the date string display format. See datestr.

  • StartDate — Date string defining the reference date. See setabstime (tscollection).

  • UserData — Any additional user-defined information

Was this topic helpful?