addevent
Adds events to a timeseries object.
Category: Language Fundamentals > Data Types
Syntax
ts = addevent(ts, e, time)
Attaches the event e to the time series ts at time.
Description
An event is a named marker, such as "peak" or "sensor reset", tied to an instant. It does not alter the data; it is metadata used to label plots or to select intervals of the series. Create events with tsdata.event(name, time).
Input arguments
ts- A
timeseriesobject. e- Event object created with
tsdata.event, or an array of them. time- Time of the event, on the time scale of
ts.
Output arguments
ts- The time series with the event stored.
Example
Mark an instant
ts = timeseries([10 20 30]', [0 1 2]);
e = tsdata.event('peak', 1);
ts = addevent(ts, e, 1);
disp(size(ts.Events))
Output
1 1
Notes
In MatLivre the stored events are returned as a cell array rather than an array of event objects.