[Eeglablist] interpolating channels by scripts

Andreas Widmann widmann at uni-leipzig.de
Mon May 15 05:34:51 PDT 2017


Hi Jose,

there are *three* ways how to use pop_interp on the command line:
(1) badchans is a (vector of) integer(s). These channels must be still in the dataset and will be replaced.
(2) badchans is a (vector of) chanlocs structure(s) of *missing* channels. This is how you try to use it.
(3) badchans is a vector of chanlocs structures of all channels as they were before removing any channels and/or should be after interpolation. pop_interp will then automatically detect which channels are missing in the dataset and interpolate them (even maintaining correct channel order). In most cases it is much easier to use the third version.

Easiest is to save the complete chanlocs structure incl. the already imported locations before removing any channels and load and use it as argument for pop_interp later.

> Second, while trying to do this, opening two datasets, I was confronted with the problem that when running a script the dataset is covertly open and the MATLAB workspace doesn't perceive it and if I ask for:
Not sure what you mean by "covertly open" and „doesn’t perceive“. Could you try to explain?

Sometimes it is easier not to interact with the EEGLAB workspace at the script level if you can avoid it (you have to use eeg_store, pop_newset, and eeglab redraw functions to interact with the EEGLAB GUI workspace) but use functions using their own workspace instead of scripts.

If you have a copy of the dataset before channel removal the whole task boils down to:

function my_interpolation

TMP = pop_loadset( … % Template before channel removal
EEG = pop_loadset( … % Dataset with missing channels
EEG = pop_interp( EEG, TMP.chanlocs );
pop_saveset( EEG, … % Dataset with interpolated channels

Hope this helps! Best,
Andreas

> Am 12.05.2017 um 17:51 schrieb José Luis <joseluisulloafulgeri at gmail.com>:
> 
> hello,
> 
> I'm currently doing the preprocessing of an EEG dataset,
> Before ICA I removed some bad channels, and after rejecting the bad components I'm trying to get back these channels interpolating with pop_interp,
> 
> However, I'm having problems for doing this. First, I have to load another dataset to indicate which channel I want to interpolate because when I open the dataset to interpolate the list of channels has updated and if I want to interpolate the channel 57, it removes and interpolates the current 57 (which was before 58),
> 
> So I need to open another dataset, and indicate that I want to interpolate the channel 57 from that original dataset with the full 66 channels,
> 
> Second, while trying to do this, opening two datasets, I was confronted with the problem that when running a script the dataset is covertly open and the MATLAB workspace doesn't perceive it and if I ask for:
> 
> EEG = pop_interp(EEG, ALLEEG(1).chanlocs(recoverChan), 'spherical'); where recoverChan = 57 (commands lines I get when testing it manually),
> 
> the system rightly warning me "Index exceeds matrix dimensions" because indeed the variable ALLEEG is empty,
> 
> Somebody knows a trick to solve this?
> 
> best
> Jose
> _______________________________________________
> 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




More information about the eeglablist mailing list