POP_EDITEVENTFIELD Load/remove event fields in a dataset. If the EEG dataset is the only inputs, a window pops up to ask for the relevant parameter values.

Usage: >> [EEG,eventnumbers] = pop_editeventfield( EEG, 'key1', 'value1', ...);

Input:
EEG   
input dataset Optional input
'latency'   
[ 'filename'|array|number ], 1-column file or array containing the latency of the events. If the arg is a single number, it will be used for all events.
'type'   
[ 'filename'|array|number ], Type (numbers) of the events. Same format as 'latency' {Default event type is 1}.
'USER_VAR'   
[ 'filename'|array|number|[] ], here 'USER_VAR' is the name of a user-defined field. If the argument is [], the field is removed from all the events.
'skipline'   
number of rows to skip for text files
'rename'   
['USER_VAR1->USER_VAR2'] rename field 'USER_VAR1' into 'USER_VAR2'. Ex: { 'rename', 'type->condition' }.
'append'   
['yes'|'no'] 'yes' = Append to the current events of the EEG dataset {default}: 'no' = Erase the previous events.
'indices'   
vector indicating the indices of the events to modify
'timeunit'   
[ latency unit in second ]. Default unit is 1 second.
'delim'   
delimiting characters in file. Default is tab and space.
'latencyinfo'   
comment string for the latency field
'typeyinfo'   
comment string for the type field
'USER_VARinfo'   
comment string for the variable USERVAR

Outputs:
EEG   
dataset with updated event field
eventnumbers   
indexes of the appended events

Example: [EEG, eventnumbers] = pop_editeventfield(EEG, 'type', 1, 'sleepstage', 'sleepstage_values.txt', 'latency', [0.100 0.130 0.123 0.400] );
This appends 4 events to the EEG struct, all of type 1,
with user-defined field ('sleepstage') values read from an
ascii 1-column file ('sleepstage_values.txt').

Notes: As indicated above, to remove a user=defined field, simply
enter an empty array [].
Ex: >> EEG = pop_editeventfield(EEG,'sleepstage',[]);
To save the events first convert them in 'array' format and
then save the array.
>> tmp = eeg_eventformat(EEG.event, 'array');
>> save -ascii filename.txt tmp

Author: Arnaud Delorme & Scott Makeig, CNL / Salk Institute, 9 Feb 2002

See also: pop_importevent, eeg_eventformat, pop_selectevent

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

Back to functions