timeseries before event
tsout = gettsbeforeevent(
timeseries object with samples occurring before the
tsevent in the input
tsin. The argument
tsevent can be either a
tsdata.event object or a character vector containing the name
of the event. When
tsevent is a
object, the time defined by
tsevent specifies the time. When
tsevent is a character vector, the first
tsdata.event object in the
tsin that matches the event name specifies the
timeseries before Event
timeseries object with an event occurring at time sample 2.
tsin = timeseries((1:5)'); tsevent = tsdata.event('MyEvent',2); tsin = addevent(tsin,tsevent); tsin.Events
EventData:  Name: 'MyEvent' Time: 2 Units: 'seconds' StartDate: ''
Create a new
timeseries object that contains the data before the event sample.
tsout = gettsbeforeevent(tsin,'MyEvent'); tsout.Time
ans = 2×1 0 1
tsin — Input
timeseries, specified as a scalar.
tsevent — Event
scalar | character vector
Event, specified as a scalar
tsdata.event object or a
character vector containing the name of an event.
n — Event number
Event number, specified as a scalar integer corresponding to the
tsdata.event of a
When the input
tsincontains date character vectors and
tseventuses numeric time, the time selected by
tseventis treated as a date that is calculated relative to the
tsinuses numeric time and
tseventuses calendar dates, the time selected by
tseventis treated as a numeric value that is not associated with a calendar date.