Home > data-analysis > manip > event > event_setdiff.m

event_setdiff

PURPOSE ^

EVENT_SETDIFF subtract one event from another

SYNOPSIS ^

function sd = event_setdiff(from, take)

DESCRIPTION ^

EVENT_SETDIFF subtract one event from another

 event_setdiff(FROM, TAKE)
   From FROM, subtracts TAKE.

 Event_setdiff treats (c)events as sets of timestamps, and calculates a
 set difference between two of them.  So if some amount of time is in both
 FROM and TAKE, it will not be in the answer.

 Example:
 >> event_setdiff([1 10 1], [3 4])
 
 ans =
 
      1     3     1
      4    10     1

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function sd = event_setdiff(from, take)
0002 %EVENT_SETDIFF subtract one event from another
0003 %
0004 % event_setdiff(FROM, TAKE)
0005 %   From FROM, subtracts TAKE.
0006 %
0007 % Event_setdiff treats (c)events as sets of timestamps, and calculates a
0008 % set difference between two of them.  So if some amount of time is in both
0009 % FROM and TAKE, it will not be in the answer.
0010 %
0011 % Example:
0012 % >> event_setdiff([1 10 1], [3 4])
0013 %
0014 % ans =
0015 %
0016 %      1     3     1
0017 %      4    10     1
0018 
0019 
0020 sd = cevent_AND(from, event_NOT(take, [-Inf, Inf]));
0021 if ~ isempty(sd)
0022     to_delete = sd(:, 1) == sd(:, 2);
0023     sd = sd(~ to_delete, :);
0024 end

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