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.
Description
Input Arguments
ts
— Input timeseries
scalar | cell array
Input timeseries
, specified as a scalar or a cell
array.
timevals
— Sample times
scalar | vector
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:
Format | Example |
---|---|
dd-mmm-yyyy
HH:MM:SS | 01-Mar-2000 15:45:17 |
dd-mmm-yyyy | 01-Mar-2000 |
mm/dd/yy | 03/01/00 |
mm/dd | 03/01 |
HH:MM:SS | 15:45:17 |
HH:MM:SS PM | 3:45:17 PM |
HH:MM | 15:45 |
HH:MM PM | 3:45 PM |
mmm.dd,yyyy
HH:MM:SS | Mar.01,2000 15:45:17 |
mmm.dd,yyyy | Mar.01,2000 |
mm/dd/yyyy | 03/01/2000 |
Data Types: double
| single
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| cell
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: tsc =
tscollection(ts,'Name','MyTSC')
Name
— tscollection
name
character vector
tscollection
name, specified as a character
vector.
isDatenum
— datenum
indicator
true
(default) | false
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
Name
— tscollection
name
character vector
tscollection
name, represented as a character
vector.
Time
— Time values
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.
TimeInfo
— Time information
collection of fields
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 (seedatestr
).StartDate
— Date character vector defining the reference date (seesetabstime
).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
Modify and Combine
addsampletocollection | Add sample to tscollection |
addts | Add timeseries to
tscollection |
delsamplefromcollection | Delete sample from tscollection |
horzcat | Horizontally concatenate tscollection objects |
removets | Remove timeseries from
tscollection |
resample | Resample tscollection time vector |
set | Set tscollection properties |
setabstime | Set tscollection times as date character vectors |
settimeseriesnames | Rename timeseries in
tscollection |
vertcat | Vertically concatenate tscollection objects |
Query
get | Query tscollection properties |
getabstime | Convert tscollection time vector to cell array |
getsampleusingtime | Subset of tscollection data |
gettimeseriesnames | Names of timeseries in
tscollection |
isempty | Determine if tscollection is empty |
length | Length of tscollection time vector |
size | Size of tscollection |
Examples
Create tscollection
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
Version History
Introduced before R2006a
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)