tscollection.setabstime
tscollection: tc = setabstime (tc, dates)
tscollection: tc = setabstime (tc, dates, format)
Set the time vector of a collection from dates.
tc = setabstime (tc, dates) gives the samples
of the collection tc the dates dates, one per sample, in
order, exactly as timeseries.setabstime gives them to a series,
in the collection’s own units; every member takes them. With
format every date is read strictly in it.
The dates need not be sorted: every member’s samples, with their quality
codes, are sorted with them. MATLAB sorts the times alone, so each
sample is given another’s date. It also reads every date by the format
of the first, forces text into format, and takes numbers and
datetime values as relative times, dropping the dates; see
timeseries.setabstime for how each is read here.
See also: tscollection.getabstime, timeseries.setabstime
Source Code: tscollection
setabstime dates the samples of every member. Unsorted dates move each member's samples with them; MATLAB sorts the dates alone.
tc = tscollection ({timeseries([10; 20; 30], [0; 1; 2], 'Name', 'a'), ...
timeseries([1; 2; 3], [0; 1; 2], 'Name', 'b')});
tc.TimeInfo.Units = 'days';
tc = setabstime (tc, {'03-Mar-2024', '01-Mar-2024', '02-Mar-2024'});
getabstime (tc)
ans =
3x1 cell array
{'01-Mar-2024 00:00:00'}
{'02-Mar-2024 00:00:00'}
{'03-Mar-2024 00:00:00'}
[tc.a.Data, tc.b.Data]
ans = 20 2 30 3 10 1