[Eeglablist] Removal of epochs (indexed according to raw data) from cleaned data

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Thu Nov 26 16:28:27 PST 2015

Dear Jodie,

I suggest you file your request for EEGLAB developpers.

That being said, here are my tricks to efficiently deal with EEGLAB events.
Just for your information.


% rename events
    allEvent = cell2mat({EEG.event.type}');
    idx2049 = find(allEvent==2049);
    [EEG.event(idx2049).type] = deal(8049);

% replace latency
   dummyA = num2cell(EEGsuggestedLatencyForFixationOnsets);
   [EEG.event(Idx).latency] = dummyA{:};

% adding 400ms to the event latencies
    allEvent = {EEG.event.type}';
    % unique(allEvent)
    stroopOnsetIdx  = find(strcmp(allEvent, 'S 71')|strcmp(allEvent, 'S
72')|strcmp(allEvent, 'S     73')|strcmp(allEvent, 'S 74'));
    stroopOnsetLatencyInFrame  = [EEG.event(stroopOnsetIdx).latency]';
    modifiedValues = bsxfun(@plus, stroopOnsetLatencyInFrame, 400);
    [EEG.event(stroopOnsetIdx).latency] = modifiedValues{:};

 % extract event labels and time stamps
    allEventLabels = mobilab.allStreams.item{eventStreanIdx}.event.label;
    eventTimeStamp = mobilab.allStreams.item{eventStreanIdx}.timeStamp; %
in second

 % import event markers and latency to EEG.event
    allEventLatency = num2cell((eventTimeStamp-EEG.urxmin)*1000);
    allUrevent      = num2cell(1:length(allEventLatency));
    EEG.event = struct('type', {}, 'latency',{}, 'urevent',{});
    [EEG.event(1,1:length(allEventLabels)).latency] = allEventLatency{:};
    [EEG.event(1,1:length(allEventLabels)).type]    = allEventLabels{:};
    [EEG.event(1,1:length(allEventLabels)).urevent] = allUrevent{:};
    EEG = eeg_checkset(EEG,'eventconsistency');

On Tue, Oct 27, 2015 at 2:33 AM, Jodie Feil <Jodie.Feil at weizmann.ac.il>

> Dear All,
> I was wondering if there is a way/script to remove unwanted epochs once
> the data has been cleaned and is stored within a STUDY design. Whereby, the
> list of the epochs/latencies which I would like to remove are categorised
> according to the raw data (pre-cleaned) and I would like to remove these
> specific epochs/latencies from the cleaned data (where a number of other
> epochs may have been removed manually during cleaning).
> For example, I have EEG data which includes the cortical response of both
> correct and incorrect performance on a behavioural task. I would now like
> to remove the epochs corresponding to the incorrect trials. I have a list
> of the epochs/latency of the incorrect trials (however, this is indexed
> according to the raw data) and I was wondering where, following cleaning,
> the original epochs/latencies would be stored within the STUDY design. I
> thought perhaps this could be done through EEG.epoch within the STUDY
> structure. However, I am not sure how to write the script to remove the
> unwanted epochs without causing problems to the STUDY structure.
> If it is too difficult within the STUDY structure, is there a way to
> script this easily for extraction from individual files?
> Thank you for your time.
> Kind regards,
> Jodie
> ---------------------
> Jodie Naim-Feil
> Post-doctoral Fellow
> Research group of Prof. Elisha Moses
> Department of Physics of Complex Systems
> Weizmann Institute of Science
> 76100 Rehovot, Israel
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu

Makoto Miyakoshi
Swartz Center for Computational Neuroscience
Institute for Neural Computation, University of California San Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20151126/5010cb80/attachment.html>

More information about the eeglablist mailing list