[FieldTrip] channel repair script

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Tue Sep 18 12:34:01 CEST 2012

Dear Dmitri,

I think you are confusing things here.
Note that you are calling two FieldTrip functions subsequently. The 
error message you are receiving results from ft_prepare_neighbours. 
ft_prepare_neighbours needs a different cfg than ft_channelrepair. The 
call you are making, does however not make much sense, because you 
already called that function a few lines before. So just drop that 
cfg.neighbours = ft_prepare_neighbours(...) line and replace it by 
cfg.neighbours = neighbours. Thereby, you are removing the function call 
that results in an error (and you already did that call), and I guess 
everything will work fine.


On 9/18/2012 10:00 AM, Dmitri Filimonov wrote:
> Dear Sir/Madam,
> My name is Dmitri Filimonov, I am a master student in University of Tartu
> (Estonia), using fieldtrip for EEG data analysis. I would like to ask some
> assistance with fieldtrip script.
> The task is to repair some EEG channels, so need to use ft_channelrepair.
> And I tried to do that after artifact rejection, so I could first see,
> which channels are noisy or disabled. I tried multiple combinations, yet
> there are still problems with the script.
> It looks like:
>>> channels_to_repair={'Fp1', 'Fp2'};
> layout_file=('C:\ fieldtrip-20120703\template\layout\EEG1010.lay');
> cfg=[];
> cfg.layout = 'EEG1010.lay';
> data.elec = ft_prepare_layout(cfg);
> neighbours = ft_prepare_neighbours(cfg, good_data)
> cfg = ft_checkconfig(cfg, 'required', {'method'});
> cfg.method = 'distance';  (or ‘nearest’)
> cfg.badchannel=channels_to_repair;
> cfg.neighbours = ft_prepare_neighbours (cfg, good_data);
> G_data = ft_channelrepair(cfg, dood_data);
> (Good_data –is a processed and filtered data, yet containing channels,
> which have to be repaired.)
> After processing the program gives me several errors:
> reading layout from file EEG1010.lay
> the call to "ft_prepare_layout" took 0 seconds and an estimated NaN MB
> ??? Error using ==> ft_checkconfig at 151
> The field cfg.method is required
> Error in ==> ft_prepare_neighbours at 77
> cfg = ft_checkconfig(cfg, 'required', {'method'});
> Other combinations emerge similar errors, or
> Error in ==> ft_neighbourselection at 30
> neighbours = ft_prepare_neighbours(varargin{:});
> Can you give me some help, what kind of ‘method’ exactly program wants me
> to mention (type)?
> Yours sincerely,
> Dmitri
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

E-Mail: jm.horschig at donders.ru.nl
Tel:    +31-(0)24-36-68493
Web: http://www.ru.nl/donders

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands

More information about the fieldtrip mailing list