[FieldTrip] Problems with ft_channelrepair

Gema Mijancos gemamm98 at gmail.com
Wed Apr 14 17:55:10 CEST 2021


Dear community,


My name is Gema Mijancos Martínez and I am working at UPC (Univeristat
Politècnica de Catalunya). Currently we are analysing TMS-EEG signals.

I have a bad channel that I would like to repair, using ft_channelrepair.


This is the code that I used:

*cfg = [];*
*cfg.channel = **'all'*
*cfg.method = **'distance'**;*
*cfg.layout = **'elec1010'**;*
*cfg.neighbourdist = 10;*
*neighbours = ft_prepare_neighbours(cfg, data_tms_raw_sim);*

*cfg = [];*
*cfg.method = **'weighted'**;*
*cfg.badchannel = **'C1'*
*; cfg.neighbours = neighbours;*
*cfg.trials = **'all'**;*
*interp = ft_channelrepair(cfg, data_tms_raw_sim);*



As I do have a channel (is not a missing one) I did not include cfg.elec
into the cfg (because reading the documentation it does not say is
compulsory to add it). However, I get the following error, which I think is
related to cfg.elec. I do not understand why I get this error:


*Error in ft_channelrepair (line 136)*

*    sens = ft_fetch_sens(cfg, data);*


Nevertheless, I decided to include cfg.elec:

*cfg.elec = **'C:\Users\MIJANCOS MARTINEZ 2\Desktop\BECA\MATLAB
CODE\Scripts\Channel_info_EEG_64_sens'**);*

which is a matlab strcutrure containing the label of the channel, their
position and the position of the electrodes (information needed by
ft_datatype_sens: sens.lablel, sens.chanpos and sens.elecpos).



However, when I run this code, I get another error:



*Error using cell/unique>celluniqueR2012a (line 249)*

*Elements of cell array input A must be character vectors (row vectors of
class char).*

*Error in cell/unique (line 142)*

*        [varargout{1:nlhs}] =
celluniqueR2012a(varargin{1},logical(flaginds(1:5)));*

*Error in cell/setdiff>cellsetdiffR2012a (line 303)*

*    uA = unique(a,order);*

*Error in cell/setdiff (line 129)*

*        [varargout{1:nlhs}] =
cellsetdiffR2012a(varargin{1:2},logical(flaginds(1:3)));*

*Error in ft_channelrepair (line 162)*

*cfg.missingchannel = setdiff(cfg.missingchannel, data.label, 'stable');*

*Error in Preprocessing_TMS_EEG (line 137)*

*    [interp] = ft_channelrepair(cfg, data_tms_raw_sim);*


I have read some threads regarding this issue, and one of the solutions was
to use cfg.layout instead of cfg.elec. Thus, I used the easycap-M10.txt
available in Fieldtrip/template but I get the same error as before.


I would really appreciate if anyone could provide some help in
understanding why I need to provide cfg.elec (which it is what I need to
do, perhaps I am wrong in my initial assumption) and why I am getting the
errors that I just mentioned.


Best regards,


Gema Mijancos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210414/867d2236/attachment.htm>


More information about the fieldtrip mailing list