[Eeglablist] How to disentangle two events?

James Desjardins jdesjardins at brocku.ca
Tue Mar 11 10:08:35 PDT 2014

Hi Florian,

The following code should be close to what you are looking for:

%make sure that the events are stored chronologically...

%loop through the events looking for events that are within a "point_range" of each other...
%store the indexes of the "too close" events in the "reject_index" array...
for i=1:length(EEG.event)-1;
    if EEG.event(i+1).latency-EEG.event(i).latency<point_range;

%purge the "too close" events...

The way that this is currently written ignores the event type an will always purge the second event of two "too close" events... even if the purge event is a "boundary" event. If you also need to place contingencies on the event type I could expand it out for you.

James Desjardins, MA
Electrophysiology Technologist
Cognitive and Affective Neuroscience Lab, Psychology Department
Jack and Nora Walker Centre for Lifespan Development Research
Brock University
500 Glenridge Ave.
St. Catharines, ON, Canada L2S 3A1
905-688-5550 x4676
"'Cause you never can tell What goes on down below!
"This pool might be bigger Than you or I know!"

McElligot's Pool
Dr.Seuss 1947
From: eeglablist-bounces at sccn.ucsd.edu [eeglablist-bounces at sccn.ucsd.edu] on behalf of florian.faehling at gmail.com [florian.faehling at gmail.com]
Sent: March-11-14 9:41 AM
To: eeglablist at sccn.ucsd.edu
Subject: [Eeglablist] How to disentangle two events?

Dear EEGLAB experts,

does anyone know a way/script with which I can delete one event if it is too close to another event (so like if “event 1” <10ms away from “event 2” then erase)?

In my experiment, I use photodiodes to send triggers. If one is active alone, this is one event (“1”/”3”), if two are active, it should be another(“2”). When both diodes are activates however, occationally I get first the one and then the other event, as if my monitor ist too slow to present light for both triggers at the same time.

In the EEG-data, this results in the two events beeing at the (almost) exact same time (i.e. “1”and”2”) so that I have to erase the one event by hand from the data. As this happens around 100 times per experiment I was wondering if this could be done automatically.

I am sorry if this is a trivial question for advanced users, I have only started using EEGlab recently.

Thank you so much for your help!


University Department of Psychiatry and Psychotherapy
Research Group Neuropsychology & Interventional Neuropsychiatry
Calwerstraße 14, 72071 Tübingen, Germany
mobil: +4917655153262
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20140311/9f4c88a0/attachment-0001.html>

More information about the eeglablist mailing list