Class Definition: tsdata.timemetadata

datatypes: tsdata.timemetadata

The time metadata of a timeseries.

A tsdata.timemetadata object describes the time vector of a timeseries: its units, an optional absolute start date, and the length, first and last times and uniform step derived from it. It is what ts.TimeInfo returns.

The derived properties Length, Start, End and Increment follow the time vector and cannot be assigned; change the time vector of the series instead, or use setuniformtime.

Source Code: tsdata.timemetadata

The tsdata.timemetadata class contains the following properties:

One of 'weeks', 'days', 'hours', 'minutes', 'seconds', 'milliseconds', 'microseconds' or 'nanoseconds', in any case, stored in lower case; 'seconds' by default. Assigning it relabels the time vector and does not rescale it. MATLAB accepts any value here.

A datestr format as a character vector, '' by default, which getabstime writes the dates in. Text holding no date field at all, such as 'bogus', is refused, where MATLAB accepts any value; MATLAB also ignores every format but the few its documentation lists, while here any datestr format is used.

A date as a character vector, or '' for a relative time vector, by default. Text, a string scalar or a scalar datetime is stored in one form, 'dd-mmm-yyyy HH:MM:SS', with milliseconds as '.FFF' when the seconds are not whole, so a date is read once, when it is assigned, and never guessed at again. Text that is not a whole date (a year, a time of day) is refused, where MATLAB accepts any value and keeps the text as given.

The step when every one is exactly equal and not zero, NaN otherwise and for a single time, [] for an empty time vector. Read-only; use setuniformtime to give a series a uniform time vector. MATLAB still accepts an assignment here, with a warning that it will not in future, and rebuilds the time vector from it.

The tsdata.timemetadata class offers the following public methods:

tsdata.timemetadata: ti = tsdata.timemetadata ()

tsdata.timemetadata: ti = tsdata.timemetadata (time)

ti = tsdata.timemetadata () returns an object for an empty time vector: Units 'seconds', Format and StartDate '', Length 0, and Start, End and Increment [].

ti = tsdata.timemetadata (time) derives Length, Start, End and Increment from the numeric vector time, which must be finite and non-decreasing. MATLAB gives an Increment of NaN here even for a uniform time; here it is the step, as for a timeseries.

A timeseries creates its own; this is needed only to assign a whole new one to ts.TimeInfo, whose time vector is then the series’ own.

See also: timeseries

tsdata.timemetadata: S = get (ti)

tsdata.timemetadata: value = get (ti, name)

tsdata.timemetadata: values = get (ti, names)

S = get (ti) returns a structure of every property of ti. value = get (ti, name) returns the property name, a character vector or a string scalar matched in any case, and values = get (ti, names) a row cell array of the properties named in the cell array names. For an array, one name gives a cell array of its size, and no name, or several, a cell array with a row per object and a column per property.

See also: tsdata.timemetadata.set, timeseries.get

tsdata.timemetadata: set (ti, name, value, …)

tsdata.timemetadata: ti2 = set (ti, name, value, …)

tsdata.timemetadata: S = set (ti)

set (ti, name, value, …) sets each property name, matched in any case, to its value, in the order given, in the variable ti of the caller, which must therefore be a variable. Metadata held by a timeseries is set with dot assignment instead, as ts.TimeInfo.Units = 'days'.

ti2 = set (ti, name, value, …) returns the modified object and leaves ti as it was. S = set (ti) returns what get (ti) does.

See also: tsdata.timemetadata.get, timeseries.set