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 from 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 from the event sample of
tsin and all samples before the event.
tsout = gettsbeforeatevent(tsin,'MyEvent'); tsout.Time
ans = 3×1 0 1 2
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.