tscollection.tscollection
tscollection: tc = tscollection ()
tscollection: tc = tscollection (ts)
tscollection: tc = tscollection ({ts1, ts2, …})
tscollection: tc = tscollection (time)
tscollection: tc = tscollection (…, 'Name', name)
Create a tscollection object.
tc = tscollection () returns an empty collection, with no
samples and no members.
tc = tscollection (ts) returns a collection of the
single timeseries ts, on its time vector and its
TimeInfo. A series with no samples gives an empty collection,
as in MATLAB.
tc = tscollection ({ts1, ts2, …})
returns a collection of the series in the cell array, a row or a column,
on the time vector of the first; every other series must have the same
times, in the same units, and the same TimeInfo.StartDate. An
empty cell array gives an empty collection, and a series with no
samples is refused, as in MATLAB.
tc = tscollection (time) returns a collection with no
members on the numeric vector time, which must be finite and is
sorted, in seconds.
Each member is named by matlab.lang.makeValidName of the name of
its series, which it then takes: a series named 'my data'
becomes the member myData, and one named '' the member
x. The names must be unique ignoring case, and none may be the
name of a property: Name, Time, TimeInfo or
Length. MATLAB refuses only Length, and a member named
Time then hides the time vector.
tc = tscollection (…,
names the collection, 'Name', name)'unnamed' by default; the option name is
matched in any case, and a later occurrence overrides an earlier one.
MATLAB ignores a second positional argument, so that
tscollection (ts1, ts2) holds ts1 only; here it
is refused.
See also: timeseries, tscollection.addts, istscollection
Source Code: tscollection
A collection holds several series on one time vector. Each member is reached by its name, and a sample of the collection is the sample of every member at one time.
temp = timeseries ([12.1; 14.5; 13.2], [0; 1; 2], 'Name', 'temp');
wind = timeseries ([3, 40; 5, 45; 4, 90], [0; 1; 2], 'Name', 'wind');
tc = tscollection ({temp, wind}, 'Name', 'station')
Time Series Collection Object: station
Time vector characteristics
Start time 0 seconds
End time 2 seconds
Member Time Series Objects:
temp
wind
size (tc)
ans = 3 2
tc.wind.Data
ans =
3 40
5 45
4 90
Member names follow matlab.lang.makeValidName, and must be unique ignoring case.
tc = tscollection (timeseries ([1; 2], [0; 1], 'Name', 'air temp')); gettimeseriesnames (tc)
ans =
1x1 cell array
{'airTemp'}
tc(i, j) selects samples, then members by position or by name. The shared Time and TimeInfo belong to the collection: assigning them assigns every member.
temp = timeseries ([12.1; 14.5; 13.2], [0; 1; 2], 'Name', 'temp');
rain = timeseries ([0; 2.5; 0.4], [0; 1; 2], 'Name', 'rain');
tc = tscollection ({temp, rain});
s = tc(2:3, 'rain');
[s.Time, s.rain.Data]
ans = 1.0000 2.5000 2.0000 0.4000
tc.TimeInfo.Units = 'hours'; tc.temp.TimeInfo.Units
ans = hours