%% Find Event by Name
% 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
ind1

% Find the second event named MyEvent.

[event2,ind2] = findEvent(tse,'MyEvent',2);
event2
ind2

% Copyright 2012 The MathWorks, Inc.