cevent_hist calculates the histogram of accumulated times of a cevent variable for each category in this variable Input: cevent: a cevent variable with three columns Output: hist: Nx3, the histgram of n categories, the list is sorted. each row is formatted: [accumulated_time category proportion]

0001 function [hist] = cevent_hist(cevent) 0002 % cevent_hist calculates the histogram of accumulated times of a cevent 0003 % variable for each category in this variable 0004 % Input: 0005 % cevent: a cevent variable with three columns 0006 % Output: 0007 % hist: Nx3, the histgram of n categories, the list is sorted. 0008 % each row is formatted: [accumulated_time category proportion] 0009 % 0010 0011 list = sort(unique(cevent(:,3))); 0012 0013 for i = 1 : size(list,1) 0014 index = find(cevent(:,3) == list(i)); 0015 hist(i,1) = sum(cevent(index,2) - cevent(index,1)); 0016 end; 0017 hist(:,2) = list; 0018 hist(:,3) = hist(:,1)/sum(hist(:,1)); 0019 0020

Generated on Tue 23-May-2017 20:00:55 by