timeseries at or before event
tsout = gettsbeforeatevent(
timeseries object with samples occurring at and before
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 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 from the event sample of
tsin and all samples before the event.
tsout = gettsbeforeatevent(tsin,'MyEvent'); tsout.Time
ans = 3×1 0 1 2
timeseries, specified as a scalar.
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
contains date character vectors and
tsevent uses numeric
time, the time selected by
tsevent is treated as a date that
is calculated relative to the
StartDate property in
tsin uses numeric time and
uses calendar dates, the time selected by
tsevent is treated
as a numeric value that is not associated with a calendar date.