% [A, means, stds] = eventDists(eventOccs)
%
% A: Cell array with all the distances
% means: Means of the corresponding lists in A
% stds: Stds of the corresponding lists in A
function [A, means, stds] = eventDists(eventOccs)
   nEvents = size(eventOccs, 1);
   nTypes = max(eventOccs(:,2));
   
   A{nTypes, nTypes} = [];
   L = zeros(1, nTypes);
   
   for i = nEvents:-1:1,
      time = eventOccs(i,1); type = eventOccs(i,2);
      for j = 1:nTypes,
         if(L(j) > 0),
            A{type,j} = [ A{type,j}, (L(j)-time) ];
         end
      end
      L(type) = time;
   end
   
   means = zeros(4);
   stds = zeros(4);
   for i = 1:(nTypes*nTypes),
      means(i) = mean(A{i});
      stds(i) = std(A{i});
   end
end
