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.


Construct event object for timeseries object


e = tsdata.event(Name,Time)
e = tsdata.event(Name,Time,'Datenum')


e = tsdata.event(Name,Time) creates an event object with the specified Name that occurs at the time Time. Time can either be a real value or a date string.

e = tsdata.event(Name,Time,'Datenum') uses 'Datenum' to indicate that the Time value is a serial date number generated by the datenum function. The Time value is converted to a date string after the event is created.


You add events by using the addevent method.

Fields of the tsdata.event object include the following:

  • EventData — MATLAB® array that stores any user-defined information about the event

  • Name — String that specifies the name of the event

  • Time — Time value when this event occurs, specified as a real number

  • Units — Time units

  • StartDate — A reference date, specified in MATLAB datestr format. StartDate is empty when you have a numerical (non-date-string) time vector.

Introduced before R2006a

Was this topic helpful?