## Error in example of counting complex events?

on 24 Sep 2012

### xsystem1 (view profile)

Hello folks,
I was going through the example of counting complex events in matlab environment. I followed example given below;
href = ""<http://www.mathworks.se/help/daq/examples/counting-complex-events-using-analog-input-data.html?prodcode=DA&language=en</a>>
If you scroll down to see the pulse duration, there will be a section where they counted the duration of each pulse.
Find the Duration of Each Pulse
A switch bounce is represented by a very short duration pulse. To find the duration of each pulse, you need to combine the rising edge and falling edge times into a single vector. The difference of any two consecutive times shows the duration of a pulse.
% Construct a vector to hold all of the times.
pulseIndices = zeros(length(risingEdge) * 2, 1);
% Store the rising edge times.
pulseIndices(1:2:end) = risingEdge;
% Store the falling edge times.
pulseIndices(2:2:end) = fallingEdge;
% Compute the pulse durations.
pulseTimes = diff(time(pulseIndices))
The image shows 15 pulses, and the dataset of pulseTimes show 30. What is this number? Is it T_on and T_off values?
I wish to know the pulse duration. Am I looking at the right code?