| EPOCH | Extract epochs time locked to specified events from continuous EEG data. |
| Usage: | >> epocheddata = epoch( data, events, timelim); >> [epocheddata, newtime, indices, rerefevent, rereflatencies ] = epoch( data, events, timelim, 'key1', value1, ... ); |
| Inputs: | |
data |
input data (chan,frames). In the case, data is a 3D array (chan, frames, epochs), epochs are extracted only if their time windows fall within existing pre-existing epochs. |
events |
vector events (expressed in seconds or points) |
timelim |
[init end] in second or points centered on the events (i.e. [-1 2]) |
| Optional inputs: | |
'srate' |
sampling rate in Hz for events expressed in seconds |
'valuelim' |
upper and lower limit of values that a trial should not overpass. If one positive value is given, consider the opposite for lower bound. Given values are also consider outlier (if equal the trial is rejected). Default: none. |
'verbose' |
['on'|'off']. Default is 'on'. |
'allevents' |
event vector containing the latencies of all events (not only those used for epoching). The function return an array 'rerefevent' which contain the latency of these events in each trials (assuming the events are included in the trial time window). These events can be in point or second but they must be in the same format as the events used for epoching. |
'alleventrange' |
for event selection, defines a time range [start end] (in seconds or data points) relative to the time-locking events. Default is same as 'timelim'. |
| Outputs: | |
epocheddata |
output (chan, frames, epochs) |
indices |
indices of accepted events |
newtime |
new time limits. See notes. |
rerefevent |
re-referenced event cell array (size nbepochs) of array indices for each epochs (note that the number of events per trial may vary). |
rereflatencies |
re-referenced latencies event cell array (same as above but indicates event latencies in epochs instead of event indices). |
| Note: | maximum time limit will be reduced by one point with comparison to the input time limits. For instance at 100 Hz, 3 seconds last 300 points, but if we assign time 0 to the first point, then we must assign time 299 to the last point. |
| Author: | Arnaud Delorme, CNL / Salk Institute, 2001 |
| See also: | pop_epoch, eeglab() |