| EEG_GETEPOCHEVENT | Return dataset event field values for all events of one or more specified types |
| Usage: | >> epochval = eeg_getepochevent( EEG, types); >> epochval = eeg_getepochevent( EEG, types, timewin, fieldname); |
| Inputs: | |
EEG |
Input dataset |
| Optional inputs: | |
types |
String containing an event type. Cell array of string may be used to select several event types; {} is all types of events. Note: Requires that a field named 'type' is defined in 'EEG.event'. |
timewin |
Event time window [start, end] in milliseconds (default []=whole epoch). |
fieldname |
Name of the field to return the values for. Default field is 'EEG.event.latency' in milliseconds (though internally this information is stored in real frames). |
| Outputs: | |
epochval |
A value of the selected field for each epoch. This is NaN if no selected event occurred during the epoch. If several vales are available for each epoch, only the first one is taken into consideration. Latencies are measured in msec relative to epoch onset. |
allepochval |
cell array with same length as the number of epoch containing all values for all epochs. This output is usefull when several value are found within each epoch. |
| 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, 'rt'); % Return the latencies (by default) in milliseconds of events having % type 'rt' (reaction time) >> latencies = eeg_getepochevent(EEG, {'target','rare'}, [0 300], 'position'); % Return the position (field 'position') of 'target' or 'rare' type % events occurring between 0 and 300 milliseconds 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() |