[Eeglablist] How can I epoch events followed by correct response only?

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Tue Oct 7 13:47:05 PDT 2014

Dear Rafal,

Check whether your event markers are string or numeric... Mikolaj's code
assumes they are string, but I know users often have numeric event markers.

By the way Mikolaj's code is wonderful as always.


On Tue, Oct 7, 2014 at 12:52 AM, Rafał Jończyk <rafal.jonczyk at gmail.com>

> Hej Mikołaj,
> Thank you so much for your help! The script makes perfect sense, but,
> somehow, Matlab tells me that the epoch range is empty.
> 'pop_epoch(): empty epoch range (no epochs were found).'
> I checked the 'EEG.event' and 'EEG.event.type', and everything looks fine
> there. Moreover, in each and every case an event of interest is followed
> either by '1' (correct) or by '2' (incorrect), so this script should be
> working easily.
> I don't think there is something wrong with the event list as it has been
> working so far when I epoched the data with a bigger time limit [-0.105
> 2.5] to "grasp" the event and correct response triggers in one epoch, run
> the ICA, and later epoch the data again in erplab with time limit [-0.1 1].
> Maybe it does not recognize the line that it should epoch to the trigger
> before '1' (prev_ev = corr_tp - 1;)?
> Best,
> Rafał
> 2014-10-04 0:42 GMT+02:00 Mikołaj Magnuski <imponderabilion at gmail.com>:
>> Hej Rafał,
>> I think the most straightforward way would be to find event indices that
>> are followed by events marking correct response. Then you can use these
>> event indices to epoch the data.
>> If your correct response events are of type '1' (EEG.event.type) as you
>> suggest you can try the following:
>> % set the epoching limis:
>> ep_lim = [-0.2, 0.7];
>> % look for 'correct' markers:
>> tps = {EEG.event.type};
>> corr_tp = find(strcmp('1', tps));
>> % the following step assumes that all correct responses are preceded with
>> events that you want to epoch you data with, this may not necassarily be
>> the case
>> prev_ev = corr_tp - 1;
>> % epoch with respect to event just before correct markers:
>> EEG = pop_epoch( EEG, {}, ep_lim, 'eventindices', prev_ev);
> --
> Rafał Jończyk, MA
> Interdisciplinary PhD Program: Language, Society, Technology and Cognition
> Faculty of English
> Adam Mickiewicz University, Poznań
> Poland
> _______________________________________________
> 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/20141007/741d1603/attachment.html>

More information about the eeglablist mailing list