function pm = getPulses(idx, tm)
%This function is for internal use only. It may be removed in the future.

%   Copyright 2011-2013 The MathWorks, Inc.

  if ~isempty(idx(1:2:end-1))
    pm.PositiveCross = signal.internal.polaritySelect(tm.Polarity(idx(1:2:end-1)), ...
                                                      tm.MiddleCross(idx(1:2:end-1)), ...
                                                      tm.MiddleCross(idx(2:2:end)));
    pm.NegativeCross = signal.internal.polaritySelect(tm.Polarity(idx(1:2:end-1)), ...
                                                      tm.MiddleCross(idx(2:2:end)), ...
                                                      tm.MiddleCross(idx(1:2:end-1)));
    pm.Width    = tm.MiddleCross(idx(2:2:end)) - tm.MiddleCross(idx(1:2:end-1));
    pm.RiseTime = signal.internal.polaritySelect(tm.Polarity(idx(1:2:end-1)), ...
                                                 tm.Duration(idx(1:2:end-1)), ...
                                                 tm.Duration(idx(2:2:end)));
    pm.FallTime = signal.internal.polaritySelect(tm.Polarity(idx(1:2:end-1)), ...
                                                 tm.Duration(idx(2:2:end)), ...
                                                 tm.Duration(idx(1:2:end-1)));
  else
    pm.PositiveCross = [];
    pm.NegativeCross = [];
    pm.Width    = [];
    pm.RiseTime = [];
    pm.FallTime = [];
  end    
end

