function [rd] = gaplength(r,t)
% Analyses gap length distribution of sequence r
% where an event is taken as the sequence value exceeding t
% Returns gap lengths (rd) 
%
if (nargin < 2)
  t=0.5
endif
z  = find(r<t);
rd = diff(z);

