[Eeglablist] Problem with marking data epoch for rejection (Tomek Ligeza)

Bethel Osuagwu b.osuagwu.1 at research.gla.ac.uk
Mon Mar 31 11:42:29 PDT 2014

Hi Tomek,

I have had a look at the function pop_rejspec() and it is quite weird on how it takes input. On EEGLAB  and probably on other versions, if you look for the lines inside the function pop_rejspec() that goes  thus:

if exist('reject') ~= 1
    reject = 1;

This code is looking for a variable 'reject' that does not exist! therefore 'reject' is always set to 1 resulting in the trials being rejected. A work arround would be to change this thus:

if exist('reject') ~= 1
    reject = 0; % %%% edited by me%%%%

and then run your command thus:


And that should produce the desired result.


From: eeglablist-bounces at sccn.ucsd.edu [eeglablist-bounces at sccn.ucsd.edu] On Behalf Of Tomek Ligęza [tsl at poczta.fm]
Sent: 28 March 2014 13:53
To: Tyler Grummett
Cc: eeglablist at sccn.ucsd.edu
Subject: Re: [Eeglablist] Problem with marking data epoch for rejection (Tomek Ligeza)

Thanks for your reply.
The pop_autorej function is based on abnormally distributed data.
My problem is that I want to use the spectral estimates method as my goal is to mark muscle activity (artifacts in 25-45 Hz frequency window).

So let me be more specific:
How can I call pop_rejspec function from matlab command line to mark trials for rejection ?

As I mentioned before, when I call it from GUI window - everything works fine. But when calling it from command line - trials that should be only marked for rejection - are actually rejected (even though 'eegplotreject' argument = 0)
Because I want to have a code for my script, I need to call this function from the command line (not from the GUI).


Od: "Tyler Grummett" <tyler.grummett at flinders.edu.au>
Do: "Tomek Ligęza" <tsl at poczta.fm>;
Wysłane: 0:30 Piątek 2014-03-28
Temat: Re: [Eeglablist] Problem with marking data epoch for rejection

Have a look at the function pop_autorej


On 28 Mar 2014, at 8:08 am, "Tomek Ligęza" <tsl at poczta.fm<mailto:tsl at poczta.fm>> wrote:

Dear List,
I have an issue regarding rejecting data epochs using spectral estimates.
I need EEGLAB to only mark trials for rejection. Everything works fine when I call the function from the menu: Tools -> Reject data epochs -> Reject by spectra and set "Reject marked trials" field to "NO".
However, when I try the same using the command:
EEG = pop_rejspec( EEG, 1,'elecrange',[1:EEG.nbchan-5] ,'threshold',[-100 30] ,'freqlimits',[25 45] ,'eegplotcom','','eegplotplotallrej',0,'eegplotreject',0);
trials that should be only marked for rejection,  are actually rejected  (despite the fact that the argument ‘eegplotreject’ is equal to zero).
Surprisingly,  this command is copied from eeghistory after calling the function pop_rejspec from menu Tools.
How can I mark trials for rejection using a command?
I would really appreciate your help as I have to use the "command option" in my data analysis.

Tomek Ligeza
Jagiellonian University, Cracow, Poland
Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu<mailto: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<mailto:eeglablist-request at sccn.ucsd.edu>

More information about the eeglablist mailing list