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

event_extract_ranges

PURPOSE ^

Extracts the subset of event_data that is in each range

SYNOPSIS ^

function chunks = event_extract_ranges(event_data, ranges)

DESCRIPTION ^

Extracts the subset of event_data that is in each range
   USAGE:
   event_extract_ranges(EVENT_DATA, RANGES)
       Goes through each of the RANGES, and for each one, finds the
       portion of the EVENT_DATA that lies within the range.  Each slice
       of the EVENT_DATA is returned in a cell of a cell array.

   EVENT_DATA may be binary event or categorical event (cevent) data.

   RANGES is actually the same format as a binary event, just a list of
   ranges, one per row.

   Some cells of the return value may be empty, if no events exist in that
   range.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function chunks = event_extract_ranges(event_data, ranges)
0002 %Extracts the subset of event_data that is in each range
0003 %   USAGE:
0004 %   event_extract_ranges(EVENT_DATA, RANGES)
0005 %       Goes through each of the RANGES, and for each one, finds the
0006 %       portion of the EVENT_DATA that lies within the range.  Each slice
0007 %       of the EVENT_DATA is returned in a cell of a cell array.
0008 %
0009 %   EVENT_DATA may be binary event or categorical event (cevent) data.
0010 %
0011 %   RANGES is actually the same format as a binary event, just a list of
0012 %   ranges, one per row.
0013 %
0014 %   Some cells of the return value may be empty, if no events exist in that
0015 %   range.
0016 
0017 
0018 chunks = cell(size(ranges, 1), 1);
0019 
0020 for range_idx = 1:size(ranges, 1)
0021     range = ranges(range_idx, :); % range(1) is start, range(2) is end
0022     
0023     chunks{range_idx} = get_event_in_scope(event_data, range);
0024     
0025 end
0026 
0027 end

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