%% find the down times of the trigger action
% @author Andi Dittrich
% @date 09.04.2012
function [v] = FindTriggerDownTimes(signal)
    % sample time
    sampleTime = 0.001;

    % temp reverence points
    start = 0;
    stop = 0;
    
    % "high" signal count
    count = 0;

    for i=1:size(signal.time)
        if (signal.signals.values(i) >= 0.98)
            if (start == 0)
                start = i;
            end
        else
            if (start ~= 0)
                stop = i;
                
                % increment index
                count = count + 1;
                
                % calculate and stroe "high" time
                v(count) = (stop-start)/(1/sampleTime);
                
                % reset reference points
                start = 0;
                stop = 0;
            end
        end        
    end
end

