Main Content

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.

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
getTimeStrQuery tsdata.event times

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: ''

Version History

Introduced before R2006a