This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


New timeseries object with samples occurring at event


ts1 = gettsatevent(ts,event)
ts1 = gettsatevent(ts,event,n)


ts1 = gettsatevent(ts,event) returns a new timeseries object ts1 with samples occurring at an event in ts, where event can be either a tsdata.event object or a string. When event is a tsdata.event object, the time defined by event is used. When event is a string, the first tsdata.event object in the Events property of ts that matches the event name specifies the time.

ts1 = gettsatevent(ts,event,n) returns a new time series ts1 with samples occurring at an event in time series ts, where n is the number of the event occurrence with a matching event name.


When the timeseries object ts contains date strings and event uses numeric time, the time selected by the event is treated as a date that is calculated relative to the StartDate property in the ts.TimeInfo.

When ts uses numeric time and event uses calendar dates, the time selected by the event is treated as a numeric value that is not associated with a calendar date.

Introduced before R2006a

Was this topic helpful?