Documentation

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. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

tsdata.event

Create tsdata.event object

Description

A tsdata.event object contains event information for a timeseries object within its properties. To add events in a tsdata.event to a timeseries, you can use the addevent function.

Creation

To create a tsdata.event object, use the tsdata.event function.

Syntax

tse = tsdata.event(eventname,eventtime)
tse = tsdata.event(eventname,eventtime,'Datenum')

Description

example

tse = tsdata.event(eventname,eventtime) creates a tsdata.event object named eventname occurring at the time eventtime.

tse = tsdata.event(eventname,eventtime,'Datenum') indicates that the eventtime value is a serial date number generated by the datenum function. eventtime is converted to a date character vector after the event is created.

Input Arguments

expand all

Event name, specified as a character vector.

Event time, specified as a numeric scalar.

Properties

expand all

Event data, represented as an array containing user-defined information about the event.

Event name, represented as a character vector.

Time values, represented as a numeric scalar.

Time units, specified as 'weeks', 'days', 'hours', 'minutes', 'seconds', 'milliseconds', 'microseconds', or 'nanoseconds'.

Start date, specified as a valid datestr character vector.

Object Functions

findEventQuery tsdata.event by name
getQuery tsdata.event properties
getTimeStrQuery tsdata.event times
setSet tsdata.event properties

Examples

collapse all

Create a tsdata.event object.

tse = tsdata.event('MyEvent',6)
    EventData: []
         Name: 'MyEvent'
         Time: 6
        Units: 'seconds'
    StartDate: ''

Create a timeseries object and add the event to the timeseries.

ts = timeseries((1:5)',1:5);
ts = addevent(ts,tse);
ts.Events
    EventData: []
         Name: 'MyEvent'
         Time: 6
        Units: 'seconds'
    StartDate: ''

Introduced before R2006a

Was this topic helpful?