This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

tscollection

Create tscollection object

Description

A tscollection object is a collection of one or more timeseries objects with the same time vector. Collections of timeseries are useful for analyzing multiple data trends that occur simultaneously.

Creation

To create a tscollection object, use the tscollection function.

Syntax

tsc = tscollection(ts)
tsc = tscollection(timevals)

Description

example

tsc = tscollection(ts) creates a tscollection object containing the timeseries objects in ts. The input ts can be a single timeseries object or a cell array of timeseries objects. Each timeseries must have the same time vector.

tsc = tscollection(timevals) defines the time vector of a tscollection.

Input Arguments

expand all

Input timeseries, specified as a scalar or a cell array.

Sample times, specified as a numeric scalar or vector, or a cell array of date character vectors. Valid date character vectors can have the following forms:

FormatExample
dd-mmm-yyyy HH:MM:SS01-Mar-2000 15:45:17
dd-mmm-yyyy01-Mar-2000
mm/dd/yy03/01/00
mm/dd03/01
HH:MM:SS15:45:17
HH:MM:SS PM3:45:17 PM
HH:MM15:45
HH:MM PM3:45 PM
mmm.dd,yyyy HH:MM:SSMar.01,2000 15:45:17
mmm.dd,yyyyMar.01,2000
mm/dd/yyyy03/01/2000

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

Name-Value Pair Arguments

Example: tsc = tscollection(ts,'Name','MyTSC')

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify the name and value pair arguments in any order as Name1,Value1,Name2,Value2.

tscollection name, specified as a character vector.

datenum indicator, specified as true or false. A value of true indicates that the time vector of the tscollection object consists of datenum values. For more information, see datenum.

Data Types: logical

Properties

expand all

tscollection name, represented as a character vector.

Time values, represented as a vector.

When TimeInfo.StartDate is empty, values are measured relative to 0. When TimeInfo.StartDate is defined, values represent date character vectors 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.

Time information, represented as a collection of the following fields describing the time vector:

  • Units — Time units with the value 'weeks', 'days', 'hours', 'minutes', 'seconds', 'milliseconds', 'microseconds', or '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 time vector (read only).

  • Format — Character vector defining the date display (see datestr).

  • StartDate — Date character vector defining the reference date (see setabstime).

  • UserData — Additional user-defined information.

To access the value of a field, use the form tsc.TimeInfo.field for a tscollection object tsc.

Object Functions

expand all

addsampletocollectionAdd sample to tscollection
addtsAdd timeseries to tscollection
delsamplefromcollectionDelete sample from tscollection
horzcatHorizontally concatenate tscollection objects
removetsRemove timeseries from tscollection
resampleResample tscollection time vector
setSet tscollection properties
setabstimeSet tscollection times as date character vectors
settimeseriesnamesRename timeseries in tscollection
vertcatVertically concatenate tscollection objects
getQuery tscollection properties
getabstimeConvert tscollection time vector to cell array
getsampleusingtimeSubset of tscollection data
gettimeseriesnamesNames of timeseries in tscollection
isemptyDetermine if tscollection is empty
lengthLength of tscollection time vector
sizeSize of tscollection

Examples

collapse all

Create a tscollection object from two timeseries objects.

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');
ts = tscollection({ts1;ts2})
Time Series Collection Object: unnamed

Time vector characteristics

      Start time            1 seconds
      End time              5 seconds

Member Time Series Objects:

      Acceleration
      Speed

Introduced before R2006a