POP_IMPORTEPOCH Export epoch and/or epoch event information to the event structure array of an EEG dataset. If the dataset is the only input, a window pops up to ask for the relevant parameter values.


Usage: >> EEGOUT = pop_importepoch( EEG ); % pop-up window mode
>> EEGOUT = pop_importepoch( EEG, filename, fieldlist, 'key', 'val', ...);

Graphic interface:
"Epoch file or array"   
[edit box] enter epoch text file name. Use "Browse" button to browse for a file. If a file with the given name can not be found, the function search for a variable with this name in the global workspace. Command line equivalent: filename.
"File input field ..."   
[edit box] enter a name for each of the column in the text file. If columns names are defined in the text file, they cannnot be used and you must copy their names in this edit box (and skip the rows). One column name for each column must be provided. The keywords "type" and "latency" should not be used. Columns names can be separated by comas, quoted or not. Command line equivalent: fieldlist.
"Field name(s) containing event latencies"   
[edit box] enter columns name(s) containing latency information. It is not necessary to define a latency field for epoch information. All fields that contain latencies will be imported as different event types. For instance, if field 'RT' contains latencies, events of type 'RT' will be created with latencies given in the RT field. See notes. Command line equivalent: 'latencyfields'.
"Field name(s) containing event durations"   
[edit box] enter columns name(s) containing duration information. It is not necessary to define a latency field for epoch information, but if you do, a duration field (or 0) must be entered for each latency field you define. For instance if the latency fields are "'rt1' 'rt2'", then you must have duration fields such as "'dr1' 'dr2'". If duration is not defined for event latency 'tr1', you may enter "0 'rt2'". Command line equivalent: 'durationfields'.
"Field name containing time locking event type(s)"   
[edit box] if one column contain the epoch type, its name must be defined in the previous edit box and copied here. It is not necessary to define a type field for the time-locking event (TLE). By default it is defined as type ''TLE'' at time 0 for all epochs. Command line equivalent: 'typefield'.
"Latency time unit rel. to seconds"   
[edit box] specify the time unit for latency columns defined above. Command line equivalent: 'timeunit'.
"Number of header lines to ignore"   
[edit box] for some text files, the first rows do not contain epoch information and have to be skipped. Command line equivalent: 'headerlines'.
"Remove old epoch and event info"   
[checkbox] check this checkbox to remove any prior event or epoch information. Command line equivalent: 'clearevents'.

Inputs:
EEG   
Input EEG dataset
filename   
Name of an ascii file with epoch and/or epoch event information organised in columns. ELSE, name of a Matlab variable with the same information (either a Matlab array or cell array).
fieldlist   
{cell array} Label of each column (data field) in the file.

Optional inputs:
'typefield'   
['string'] Name of the field containing the type(s) of the epoch time-locking events (at time 0). By default, all the time-locking events are assigned type 'TLE' (for "time-locking event").
'latencyfields'   
{cell array} Field names that contain the latency of an event. These fields are transferred into events whose type will be the same as the name of the latency field. (Ex: field RT -> type 'RT' events).
'durationfields'   
{cell array} Field names that contain the duration of an event. See also graphic interface help above.
'timeunit'   
[float] Optional unit for latencies relative to seconds. Ex: sec -> 1, msec -> 1e-3. Default: Assume latencies are in time points (relative to the time-zero time point in the epoch).
'headerlines'   
[int] Number of header lines in the input file to ignore. {Default 0}.
'clearevents'   
['on'|'off'], 'on'-> clear the old event array. {Default 'on'}

Output:
EEGOUT   
EEG dataset with modified event structure

FAQ: 1) Why is this function so complex? This function can handle as many events
per epochs as needed, and the information is stored in terms of events
rather than epoch information, which requires some conversion.
2) Can I access epoch information later? The epoch information is stored in
"EEG.event" and the information is stored in terms of events only. For
user convenience the "EEG.epoch" structure is generated automatically
from the event structure. See EEGLAB manual for more information.

Authors: Arnaud Delorme & Scott Makeig, CNL / Salk Institute, 11 March 2002

See also: eeglab()

See the matlab file pop_importepoch.m (may require other functions)

Back to functions