% Removing undesired events from EEG sets
% Author: Ramon Martinez-Cancino

 path2data = {'../s01raw/', '../s02raw/'};
 filename = {'s01.set', 's02.set'};
 
 [ALLEEG EEG CURRENTSET ALLCOM] = eeglab;
 
 for isubj = 1: length(path2data)
     EEG = pop_loadset('filename',filename{isubj},'filepath',path2data{isubj});
     indx2delete = find(strncmpi({EEG.event.type}, 'condition', 9));
     EEG = pop_editeventvals( EEG, 'delete', indx2delete);
     
     indx2delete = find(strncmpi({EEG.event.type}, '201', 3));
     EEG = pop_editeventvals( EEG, 'delete', indx2delete);
     EEG = pop_saveset( EEG, 'filename',filename{isubj},'filepath',path2data{isubj});
 end
 
 