EEG_GETEPOCHEVENT | Return event field values for all events of one or more types |
Usage: | >> epochval = eeg_getepochevent( EEG, types); >> epochval = eeg_getepochevent( EEG, types, timewin, fieldname); |
Inputs: | |
EEG |
Input dataset |
Optional inputs: | |
types |
Cell array of a subset of event types. {} is all type events. Note: this requires that a field named 'type' is defined in 'EEG.event'. |
timewin |
Event time window [start, end] in seconds (default []=whole epoch). |
fieldname |
Name of the field to return the values for. Default field is the event 'latency' in seconds (though internally this is stored in frames) |
Outputs: | |
epochval |
A value of the selected field for each epoch; this is NaN if no selected event occurred during the epoch. Latencies are measured in msec relative to epoch onset. |
Notes: | 1) Each epoch structure refers to the events that occurred during its time window. This function allows the user to return specified field values for a subset of the defined events. 2) If several of the selected events occur during a single epoch, a warning is issued, and value of ONLY THE FIRST event in the epoch is returned. If NO EVENT is selected in a given epoch, the value returned is NaN. 3) If the user elects to return the latency field, eeg_getepochevent recomputes the latency of each event relative to the epoch time limits. |
Example: | >> latencies = eeg_getepochevent(EEG, {'target','rare'}, [0 0.3]); % Return the latencies (by default) of 'target' or 'rare' type % events occurring between 0 and 0.3 sec of each epoch. % Returns NaN for epochs with no such events. (See Notes above). |
Author: | Arnaud Delorme & Scott Makeig, CNL / Salk Institute, 15 Feb 2002 |
See also: | eeglab, epoch |