gettsatevent

Samples of a timeseries located exactly at an event time.

Category: Language Fundamentals > Data Types

Syntax

tsout = gettsatevent(ts, event)

Returns the samples whose time equals the event time.

Description

Events are added with addevent. The result is a new timeseries; its Time and Data hold the selected samples. No interpolation is done: an event between two samples selects nothing.

Input arguments

ts
timeseries with at least one event.
event
Event name as text, or the event index.

Output arguments

tsout
timeseries with the matching samples; empty if no sample has that time.

Example

Event on a sample

ts = timeseries((10:10:50)', (0:4)');
ts = addevent(ts, 'k', 2);
r = gettsatevent(ts, 'k');
disp(r.Time)
disp(r.Data)
Output
     2
    30

See also

gettsafteratevent gettsbeforeatevent gettsbetweenevents addevent delevent