[FieldTrip] Channel interpolation error

MILÁN MAILLO, IRIS iris.milan at upf.edu
Tue May 7 11:35:43 CEST 2019


Hi Raphaël,
Many thanks for your answer. In the end it was a stupid error! What worked
was to load the mat file of the layout, change the cfg.layout and get rid
of cfg.elec. I upload my code fixed in case anyone else faces the same
problem:

%load layout
load('C:\Program
Files\MATLAB\fieldtrip20181107\template\layout\acticap-64ch-standard2.mat')
%prepare neighbours
cfg = [];
cfg.method = 'triangulation';
cfg.channel = 'all';
cfg.layout = lay;
cfg.feedback ='yes';
neighbours = ft_prepare_neighbours(cfg, data_ica_cleaned);

% interpolate noisy channels
cfg = [];
cfg.badchannel     = {'Fp1';'F7';'F8';'C6';'TP8';'P8';'FT10'};
cfg.method         = 'weighted';
cfg.neighbours     = neighbours;
cfg.layout = lay;
interpolated_data = ft_channelrepair(cfg,data_ica_cleaned);

Best,
Iris

Missatge de Raphaël Thézé <raphael.theze at gmail.com> del dia dv., 3 de maig
2019 a les 17:20:

> Hi Iris,
>
> Have your tried to put in your cfg for ft_channelrepair:
> cfg.elec = ft_read_sens( 'acticap-64ch-standard2.mat');
>
> If that does not work, maybe your electrode file is the problem.
>
> Cheers,
> Raphaël
>
>
> Le ven. 3 mai 2019 à 16:35, MILÁN MAILLO, IRIS <iris.milan at upf.edu> a
> écrit :
>
>> Hi everyone,
>> I am trying to interpolate some noisy channels but I keep getting an
>> error I am not able to solve. Here is my code:
>>
>> %prepare neighbours
>> cfg = [];
>> cfg.method = 'distance';
>> cfg.channel = 'all';
>> cfg.layout = 'acticap-64ch-standard2.mat';
>> cfg.feedback ='yes';
>> neighbours = ft_prepare_neighbours(cfg, data_ica_cleaned);
>>
>> % interpolate noisy channels
>> cfg = [];
>> cfg.badchannel     = {'F8','FT9','FT7'};
>> cfg.method         = 'weighted';
>> cfg.neighbours     = neighbours;
>> cfg.elecfile = 'acticap-64ch-standard2.mat';
>> interpolated_data = ft_channelrepair(cfg,data_ica_cleaned);
>>
>> And the error I get is this:
>>
>> Undefined function or variable 'lab'.
>> Error in channelposition (line 331)
>> n = size(lab,2);
>> Error in ft_datatype_sens (line 350)
>>         [chanpos, chanori, lab] = channelposition(sens);
>> Error in ft_datatype_sens (line 158)
>>     sens = ft_datatype_sens(sens, 'version', '2011v2');
>> Error in ft_read_sens (line 475)
>> sens = ft_datatype_sens(sens);
>> Error in ft_fetch_sens (line 150)
>>   sens = ft_read_sens(cfg.elecfile);
>> Error in ft_channelrepair (line 129)
>>     sens = ft_fetch_sens(cfg, data);
>>
>>
>> I don't know if I'm getting this error because I haven't defined the
>> structure for EEG channels (sens.label, sens.chanpos, sens.elecpos,
>> sens.tra), but I haven't done it because I'm not really sure of how to do
>> it.
>>
>> Could anyone help me?
>> Thanks a million!!
>>
>> *Iris Milán Maillo*
>>
>> PhD Student
>> Speech Production and Bilingualism (SPB) <https://www.upf.edu/web/spb>
>> Center for Brain and Cognition (CBC) <http://cbc.upf.edu/cbc.upf.edu/>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> https://doi.org/10.1371/journal.pcbi.1002202
>>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>


-- 
*Iris Milán Maillo*

PhD Student
Speech Production and Bilingualism (SPB) <https://www.upf.edu/web/spb>
Center for Brain and Cognition (CBC) <http://cbc.upf.edu/cbc.upf.edu/>

Carrer de Ramon Trias Fargas, 25-27, 08005 Barcelona | Edifici Merce
Rodoreda, (room 24.311)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190507/bf32f045/attachment-0002.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list