% Used for importing event labels to EGI data tagged with the event marker stm+ event_list = loadtxt('text_file_name.txt'); ; % Load the appropriate text file. indices = strmatch('stm+', { EEG.event.type }, 'exact')'; % Looks for events which contain the tag stm+ only if length(event_list) ~= length(indices) % Produces an error message if the files are not the same length error('Mismatch between the number of events in the text file and in the data'); end; for index = 1:length(event_list) EEG.event(indices(index)).type = [ EEG.event(indices(index)).type num2str(event_list{index}) ]; end;