[Eeglablist] Identity bad EEG channels without running the function on my EOG channels as well

Cedric Cannard ccannard at protonmail.com
Fri Jan 2 00:06:59 PST 2026


Dear Paul,

Yes, there are a few ways to exclude your EOG channels.

You can use the default clean_raw_data() function that has a channel exclusion option to exclude specific channels. For example:

% specify channels to ignore (29 and 30)
EEG = clean_rawdata(EEG, [], [], [], [], [], [], 'off', [29 30]);

However, note that clean_rawdata() performs multiple cleaning steps beyond just channel rejection, so if you specifically only want the channel cleaning functionality, you could do:


%STEP 6: auto-detect Bad Channels using clean_channels function

% retain the original EEG structure as a backup
origEEG = EEG;

% save original channel list
origChanList = transpose({EEG.chanlocs.labels});

% temporarily remove EOG channels (channels 29 and 30)
EOG_data = EEG.data(29:30, :, :);  % save EOG data
EOG_chanlocs = EEG.chanlocs(29:30);  % save EOG channel info
EEG = pop_select(EEG, 'nochannel', [29 30]);  % remove EOG channels

% run clean_channels on EEG data only
EEG = clean_channels(EEG);

% save new channel list (after cleaning)
newChanList = transpose({EEG.chanlocs.labels});

% identify which channels were removed
myBadChan = setdiff(origChanList(1:28), newChanList);  % only compare EEG channels

% add EOG channels back
EEG.data(end+1:end+2, :, :) = EOG_data;
EEG.chanlocs(end+1:end+2) = EOG_chanlocs;
EEG.nbchan = size(EEG.data, 1);


Cedric Cannard

Sent from Proton Mail for iOS.

-------- Original Message --------
On Monday, 12/22/25 at 18:19 Brancaleone, Paul via eeglablist <eeglablist at sccn.ucsd.edu> wrote:
Hello,

I am creating a script to process EEG/ERP data (here called "EEG"). At the step to identify "bad" channels, I have a script as follows:

 %STEP 6: auto-detect Bad Channels using clean_channels function

    %retain the original EEG structure as a backup
    origEEG=EEG;

    %save original channel list
    origChanList = transpose({EEG.chanlocs.labels});

    %remove bad channels
    EEG=clean_channels(EEG);

    %save new channel list
    newChanList = transpose({EEG.chanlocs.labels});

    %which channels were removed?
    myBadChan = setdiff(origChanList,newChanList);

    %save them out
    %BadChannelsFile = fullfile(DIR,[SUB{i}, '_Bad_Channels.csv']);
    %# write line-by-line
    fid = fopen([DIRout '/' SUB{i}, '_Bad_Channels.csv'],'wt');
    for myindex=1:size(myBadChan,1)
        fprintf(fid, '%s,%d,%d\n', myBadChan{myindex,:});
    end
    fclose(fid);
    %this file will go to output directory

My question is: channel numbers 29 and 30 out of 31 total channels are my VEOG and HEOG, respectively. Is there a way to run the clean_channels() function on the EEG data without running it on the EOG channels as well? I do not want to mark them as "bad" or interpolate them, but I can't find a way to tun this fucntion without running it on the entire EEG file with the EOGs included.

Paul J. Brancaleone, M.S.
PhD Candidate
Social Cognitive and Addiction Neuroscience Lab
University of Iowa, Iowa City, IA
pbrancaleone at uiowa.edu
https://urldefense.com/v3/__https://scan.lab.uiowa.edu/__;!!Mih3wA!AMXv-_ObBE26JZk4iUm0gVYVWLOSaOY8B8do2Tg-uHtZ_bRMgx3tvuoozNFoOsMkBYS5UA3zogiIFMGoe9x5fULopFHrbGwCyvo$
_______________________________________________
To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu or visit https://sccn.ucsd.edu/mailman/listinfo/eeglablist .



More information about the eeglablist mailing list