[Eeglablist] eegplot and TMPREJ

Tarik S Bel-Bahar tarikbelbahar at gmail.com
Fri May 5 16:32:31 PDT 2017

Hello Max, hoping all is well. Here are some notes below that should
help you move forward. Cheers!

Overall, you might need to be loading and updating EEG structures in
memory via commands such as
and via eeg checkset.
See what you get when you run directly from the GUI and then type
eegh. You will see the necessary updating commands to emulate there.

For accessing and using the TMPREJ info here's some suggestions:

*********************Try these any of these three
Type eegh after you run the visual detection. You can type via script
to command line, and then grab the ouput, which contains the time
periods that were rejected. So if you parse the output of eegh and
grab the times, you should be fine. This can be done all by script.

One way is to go into your copy of pop_eegplot, and try adding the
following line
    'savethesetimes=TMPREJ;' ...
before this line:
               'clear EEGTMP tmpcom;' ];
In my case it seems like it started saving these out into
"savethesetimes" after I ran pop_eegplot from the gui and selected
some periods. You could tweak this further.
If you can read matlab code, you can see that this area is where the
function treats non-trialled continuous data, and applies TMPREJ info
using another eeglab function, eeg_reject. So you could save the data
as a variable for use in the future with your other (same) files.

Alternatively, try running Reject Continuous data but with very high
thresholds, which should throw up a window to review with no

options = {'elecrange',[1:128], 'freqlimit', {  [0 10] [35 128]  },
'epochlength', .5, 'overlap', .5, 'contiguous', 2
[EEG, selectedregions] = pop_rejcont( EEG, 'threshold', [10 10],
'eegplot', 'on', 'verbose', 'off', options{:} );

At this point, the function will run, and then should throw up an
eegplot window that you can review, and add or remove periods to.
Then close and overwrite the file. Note that "selectedregions" will
contain the selected time periods that were removed.

Alternatively you can try to run eegplot or pop_eegplot with the
correct flag from the command line (see documentation) so it saves
marked periods to the EEG.reject variable and does not reject the

If you were working with trial data things would be a little easier.
   *run trial artifact detection, then...
 if ~isempty(EEG.reject.rejjp) || ~isempty(EEG.reject.rejkurt) ||
EEG = eeg_rejsuperpose( EEG, 1, 1, 1, 1, 1, 1, 1, 1);
theinfoAboutWhichTrialswereRemoved = EEG.reject.rejglobal; %this saves
marked trial info across all artifact measures in eeglab
 EEG = pop_rejepoch( EEG, EEG.reject.rejglobal ,0);

More information about the eeglablist mailing list