addevent

Add event to timeseries

Syntax

tsout = addevent(tsin,tsevent)
tsout = addevent(tsin,eventname,eventtime)

Description

tsout = addevent(tsin,tsevent) adds a tsdata.event object tsevent to the timeseries object tsin. The event tsevent can be a single tsdata.event object or an array of tsdata.event objects.

example

tsout = addevent(tsin,eventname,eventtime) creates a tsdata.event object and adds it to the Events property of tsin. The argument eventname can be a single event name character vector or a cell array of event name character vectors. eventtime is the corresponding event time or a cell array of event times.

Examples

collapse all

Create a timeseries object and add an event to it.

tsin = timeseries((1:5)');
tsout = addevent(tsin,'Event1',0);
tsout.Events
    EventData: []
         Name: 'Event1'
         Time: 0
        Units: 'seconds'
    StartDate: ''

Input Arguments

collapse all

Input timeseries, specified as a scalar.

Data Types: timeseries

Event, specified as a scalar tsdata.event object or an array of tsdata.event objects.

Event name, specified as a character vector containing the name of a tsdata.event object or a cell array containing multiple event names.

Data Types: char | cell

Event time, specified as a scalar time or a cell array of times corresponding to the events in eventname.

Introduced before R2006a