Main Content

addevent

Add event totimeseries

Description

tsout = addevent(tsin,tsevent)adds atsdata.eventobjecttseventto thetimeseriesobjecttsin. The eventtseventcan be a singletsdata.eventobject or an array oftsdata.eventobjects.

example

tsout = addevent(tsin,eventname,eventtime)creates atsdata.eventobject and adds it to theEventsproperty oftsin. The argumenteventnamecan be a single event name character vector or a cell array of event name character vectors.eventtimeis the corresponding event time or a cell array of event times.

Examples

collapse all

创建一个timeseriesobject 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

Inputtimeseries, specified as a scalar.

Data Types:timeseries

Event, specified as a scalartsdata.eventobject or an array oftsdata.eventobjects.

Event name, specified as a character vector containing the name of atsdata.eventobject 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 ineventname.

Introduced before R2006a