<div dir="ltr"><div dir="ltr"><p class="MsoNormal"><span lang="EN-GB" style="font-family:Arial,sans-serif">Dear community,<span></span></span></p><p class="MsoNormal"><span lang="EN-GB" style="font-family:Arial,sans-serif"><br></span></p>

<p class="MsoNormal"><span lang="EN-GB" style="font-family:Arial,sans-serif">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.<span></span></span></p>

<p class="MsoNormal"><span lang="EN-GB" style="font-family:Arial,sans-serif">I have a bad channel that I would like to repair,
using ft_channelrepair.</span></p><p class="MsoNormal"><span lang="EN-GB" style="font-family:Arial,sans-serif"><br></span></p>

<p class="MsoNormal"><span lang="EN-GB" style="font-family:Arial,sans-serif">This is the code that I used:</span></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">cfg = [];</span></i><span lang="EN-GB" style="font-family:Arial,sans-serif"><br>
</span><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">cfg.channel = </span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:rgb(170,4,249)">'all'</span></i><span lang="EN-GB" style="font-family:Arial,sans-serif"><br>
</span><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">cfg.method = </span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:rgb(170,4,249)">'distance'</span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">;</span></i><span lang="EN-GB" style="font-family:Arial,sans-serif"><br>
</span><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">cfg.layout = </span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:rgb(170,4,249)">'elec1010'</span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">;</span></i><span lang="EN-GB" style="font-family:Arial,sans-serif"><br>
</span><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">cfg.neighbourdist = 10;</span></i><span lang="EN-GB" style="font-family:Arial,sans-serif"><br>
</span><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">neighbours = ft_prepare_neighbours(cfg, data_tms_raw_sim);</span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif"><br>
<br>
<span style="color:black"><span></span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">cfg = [];</span></i><span lang="EN-GB" style="font-family:Arial,sans-serif"><br>
</span><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">cfg.method = </span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:rgb(170,4,249)">'weighted'</span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">;</span></i><span lang="EN-GB" style="font-family:Arial,sans-serif"><br>
</span><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">cfg.badchannel = </span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:rgb(170,4,249)">'C1'</span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">;<br>
cfg.neighbours = neighbours;</span></i><span lang="EN-GB" style="font-family:Arial,sans-serif"><br>
</span><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">cfg.trials = </span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:rgb(170,4,249)">'all'</span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">;</span></i><span lang="EN-GB" style="font-family:Arial,sans-serif"><br>
</span><i><span lang="EN-US" style="font-family:Arial,sans-serif">interp = ft_channelrepair(cfg, data_tms_raw_sim);</span></i><span lang="EN-GB" style="font-family:Arial,sans-serif"><span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0cm;line-height:normal"><i><span lang="EN-US" style="font-family:Arial,sans-serif"> </span></i></p>

<p class="MsoNormal"><span lang="EN-GB" style="font-family:Arial,sans-serif">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:<span></span></span></p><p class="MsoNormal"><span lang="EN-GB" style="font-family:Arial,sans-serif"><br></span></p>

<p class="MsoNormal"><i><span lang="EN-GB" style="font-family:Arial,sans-serif">Error in ft_channelrepair (line 136)<span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-GB" style="font-family:Arial,sans-serif">    sens =
ft_fetch_sens(cfg, data);<span></span></span></i></p><p class="MsoNormal"><i><span lang="EN-GB" style="font-family:Arial,sans-serif"><br></span></i></p>

<p class="MsoNormal"><span lang="EN-GB" style="font-family:Arial,sans-serif">Nevertheless, I decided to include cfg.elec:<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0cm;line-height:normal"><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">cfg.elec = </span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:rgb(170,4,249)">'C:\Users\MIJANCOS
MARTINEZ 2\Desktop\BECA\MATLAB CODE\Scripts\Channel_info_EEG_64_sens'</span></i><i><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">);<span></span></span></i></p>

<p class="MsoNormal" style="margin-bottom:0cm;line-height:normal"><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">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).<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0cm;line-height:normal"><span lang="EN-US" style="font-family:Arial,sans-serif;color:black"> </span></p>

<p class="MsoNormal" style="margin-bottom:0cm;line-height:normal"><span lang="EN-US" style="font-family:Arial,sans-serif;color:black">However, when I run this code, I get
another error:<span></span></span></p>

<p class="MsoNormal" style="margin-bottom:0cm;line-height:normal"><span lang="EN-US" style="font-family:Arial,sans-serif;color:black"> </span></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif">Error using cell/unique>celluniqueR2012a (line 249)<span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif">Elements of cell array input A must be character
vectors (row vectors of class char).<span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif">Error in cell/unique (line 142)<span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif">       
[varargout{1:nlhs}] =
celluniqueR2012a(varargin{1},logical(flaginds(1:5)));<span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif">Error in cell/setdiff>cellsetdiffR2012a (line 303)<span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif">    uA =
unique(a,order);<span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif">Error in cell/setdiff (line 129)<span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif">       
[varargout{1:nlhs}] = cellsetdiffR2012a(varargin{1:2},logical(flaginds(1:3)));<span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif">Error in ft_channelrepair (line 162)<span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif">cfg.missingchannel = setdiff(cfg.missingchannel,
data.label, 'stable');<span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif">Error in Preprocessing_TMS_EEG (line 137)<span></span></span></i></p>

<p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif">    [interp] =
ft_channelrepair(cfg, data_tms_raw_sim);<span></span></span></i></p><p class="MsoNormal"><i><span lang="EN-US" style="font-family:Arial,sans-serif"><br></span></i></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:Arial,sans-serif">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.<span></span></span></p><p class="MsoNormal"><span lang="EN-US" style="font-family:Arial,sans-serif"><br></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:Arial,sans-serif">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.<span></span></span></p><p class="MsoNormal"><span lang="EN-US" style="font-family:Arial,sans-serif"><br></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:Arial,sans-serif">Best regards,<span></span></span></p><p class="MsoNormal"><span lang="EN-US" style="font-family:Arial,sans-serif"><br></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:Arial,sans-serif">Gema Mijancos<span></span></span></p></div></div>