%% timeseries Between Events
% Create a timeseries object with events occurring at time samples 1 and 3.

tsin = timeseries((1:5)');
tsevent1 = tsdata.event('StartEvent',1);
tsevent2 = tsdata.event('EndEvent',3);
tsin = addevent(tsin,[tsevent1 tsevent2]);

% Create a new timeseries object that contains the data between the two event samples.

tsout = gettsbetweenevents(tsin,'StartEvent','EndEvent');
tsout.Time

% Copyright 2012 The MathWorks, Inc.