stim_codes = [11:16 21:26 31:36 41:46 51:56 61:66]; % Stim code shown at time zero
resp_codes = 71:74; % accuracy response given somewhere between stimulus offset and time +1500ms
awareness_codes = 81:84; % awareness report given somwhere between accuracy response+300ms and response+2000ms
new_events = [];
count = 1;
for iEvent = 1:size(EEG.event,2)
    % check if event is a stimulus
    if sum(ismember(stim_codes, EEG.event(iEvent).type)) > 0
        new_events(count).type = EEG.event(iEvent).type;
        new_events(count).latency = 0;
        new_events(count).urevent = count;
        
        % look for match and put them together in new_events
        for match = 1:size(EEG.event,2)
            if EEG.event(match).epoch == EEG.event(iEvent).epoch && sum(ismember(awareness_codes, EEG.event(match).type)) > 0
                % new_events(count).aware_type =  EEG.event(match).type; % Get awareness response category
                % new_events(count).aware_latency = EEG.event(match).latency - EEG.event(iEvent).latency; % get latency from stimulus
                % new_events(count).comb_latency = 0; % get 3rd code for combination of both stim and awareness
                new_events(count).epoch = EEG.event(iEvent).epoch; % get epoch number
                new_events(count).type = [num2str(EEG.event(iEvent).type) '_' num2str(EEG.event(match).type)]; % get 3rd code for combination of both stim and awareness
                
                % add if statement to create combinations for new events STIM + PAS (to keep new event codes as integers)
                if EEG.event(iEvent).type == 11 && EEG.event(match).type == 81
                    new_events(count).type = 1181;
                elseif EEG.event(iEvent).type == 11 && EEG.event(match).type == 82
                    new_events(count).type = 1182;
                
                    % ETC...
                    
                end
                
                count = count + 1;
            end
        end
    end
end
