Home > data-analysis > manip > cevent > cevent_latest_event.m

cevent_latest_event

PURPOSE ^

CEVENT_LATEST_EVENT

SYNOPSIS ^

function cevent_latest = cevent_latest_event(cevent)

DESCRIPTION ^

CEVENT_LATEST_EVENT

 cevent_latest_event(cevent_data)
   If there are no overlapping events in cevent_data, returns it
   unchanged.  If events overlap, they are changed so there is no overlap,
   and the event which starts latest is used as the 'current' one.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function cevent_latest = cevent_latest_event(cevent)
0002 %CEVENT_LATEST_EVENT
0003 %
0004 % cevent_latest_event(cevent_data)
0005 %   If there are no overlapping events in cevent_data, returns it
0006 %   unchanged.  If events overlap, they are changed so there is no overlap,
0007 %   and the event which starts latest is used as the 'current' one.
0008 
0009 cevent_latest = [];
0010 
0011 for R = 1:size(cevent, 1)
0012     row = cevent(R, :);
0013     
0014     cevent_latest = event_setdiff(cevent_latest, row);
0015     cevent_latest(end+1, :) = row;
0016     
0017     % the set difference can re-order things
0018     cevent_latest = sortrows(cevent_latest);
0019 end
0020

Generated on Tue 23-May-2017 03:00:58 by m2html © 2005