Main Content

findEvent

Query tsdata.event by name

Description

[event,ind] = findEvent(tse,tsename) returns the first tsdata.event object event with the name tsename in an array of tsdata.event objects tse. The output argument ind is the index of tse corresponding to event.

example

[event,ind] = findEvent(tse,tsename,n) returns the nth tsdata.event object in the array tse and its index.

Examples

collapse all

Create a vector containing two tsdata.event objects with the name MyEvent. Find the first event named MyEvent.

tse1 = tsdata.event('MyEvent',1);
tse2 = tsdata.event('MyEvent',2);
tse = [tse1 tse2];
[event1,ind1] = findEvent(tse,'MyEvent');
event1
    EventData: []
         Name: 'MyEvent'
         Time: 1
        Units: 'seconds'
    StartDate: ''
ind1
ind1 = 1

Find the second event named MyEvent.

[event2,ind2] = findEvent(tse,'MyEvent',2);
event2
    EventData: []
         Name: 'MyEvent'
         Time: 2
        Units: 'seconds'
    StartDate: ''
ind2
ind2 = 2

Input Arguments

collapse all

Input tsdata.event, specified as an array.

tsdata.event name, specified as a character vector.

tsdata.event number, specified as an integer scalar.

Output Arguments

collapse all

Output tsdata.event, specified as a scalar.

tsdata.event index, specified as an integer scalar.

Version History

Introduced before R2006a