<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dear colleagues, </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I came across a surprising error and I am struggling to figure it out. </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif;">I wrote a few scripts last year in version</span><span style="font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);"> </span><span style="font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);">fieldtrip-20200409.
 They all worked fine, last time I worked with those scripts in that version was January 2021. I had to take care of a few other tasks since then, so the project was on pause. I had my work laptop upgraded in the meantime which meant I had to upgrade to the
 newest Fieldtrip version.</span><br>
</div>
<div style=""><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"></span></div>
<div style=""><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div style=""><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">I started working on that same project again, in version fieldtrip-20210525, and noticed layout file issues when
 interpolating channels. </span></div>
<div style=""><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div style=""><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">For a bit of background,  I am using the Mobita water-based 32 EEG electrode system. I created my own layout file
 in the previous Fieldtrip version which worked without any issues in all scripts.</span></div>
<div style=""><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">I now have an error using the ft_channelrepair() funtion and I think it relates to the ft_read_sens() funtion. </span></div>
<div style=""><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div style=""><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><b>The cfg I used: </b></span></div>
<div style=""><span style="color: rgb(0, 0, 0); font-family: "Courier New", monospace; font-size: 12pt;">cfg = [];</span><br>
</div>
<div style=""><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">cfg.method          = 'spline';</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">cfg.neighbours      = neighbours_EEG;</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">cfg.badchannel      = badchannels_train;</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">cfg.senstype        = 'EEG';</span></div>
</span><span style="display: inline !important; font-family: "Courier New", monospace; font-size: 12pt; color: rgb(0, 0, 0);">cfg.elec            = layout_file;</span><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div style=""><span style="display: inline !important; font-family: "Courier New", monospace; font-size: 12pt; color: rgb(0, 0, 0);">mydata_interpolated_train = ft_channelrepair(cfg, mydata_artrm_train);</span><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div style=""><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div style=""><span style="display: inline !important; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div><br>
</div>
<div><b>The layout file fields are:</b></div>
<div><span style="font-family: "Courier New", monospace;">pos: [34×2 double]</span>
<div><span style="font-family: "Courier New", monospace;">label: {34×1 cell}</span></div>
<div><span style="font-family: "Courier New", monospace;">width: [34×1 double]</span></div>
<div><span style="font-family: "Courier New", monospace;">height: [34×1 double]</span></div>
<div><span style="font-family: "Courier New", monospace;">outline: {1×4 cell}</span></div>
<div><span style="font-family: "Courier New", monospace;">mask: {[101×2 double]}</span></div>
<span style="font-family: "Courier New", monospace;">cfg: [1×1 struct]</span><br>
</div>
<div><br>
</div>
<div>But I can only see these fields if I use the function importdata(). When I use the function ft_read_sens() and when I try to interpolate channels, I get the following error:</div>
<div><br>
</div>
<div><b>Error message:</b></div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">Unrecognized function or variable 'lab'.</span>
<div><br>
</div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">Error in channelposition (line 352)</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">n = size(lab,2);</span></div>
<div><br>
</div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">Error in ft_datatype_sens (line 438)</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">        [chanpos, chanori, lab] = channelposition(sens);</span></div>
<div><br>
</div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">Error in ft_datatype_sens (line 240)</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">    sens      = ft_datatype_sens(sens, new_argin{:});</span></div>
<div><br>
</div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">Error in ft_datatype_sens (line 207)</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">    sens      = ft_datatype_sens(sens, new_argin{:});</span></div>
<div><br>
</div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">Error in ft_datatype_sens (line 180)</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">    sens      = ft_datatype_sens(sens, new_argin{:});</span></div>
<div><br>
</div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">Error in ft_read_sens (line 539)</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt;">sens = ft_datatype_sens(sens);</span></div>
<span style="font-size: 12pt;"> </span><br>
</div>
 </span></div>
<div style=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">There are no errors when I plot the channels using the following code though and it all looks absolutely fine:</span></div>
<div style=""><span style="font-family: "Courier New", monospace; font-size: 12pt; color: rgb(0, 0, 0);">cfg = [];</span>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt; color: rgb(0, 0, 0);">cfg.layout = layout_m; %layout_m is imported from the layout_file using the importdata() function</span></div>
<div><span style="font-family: "Courier New", monospace; font-size: 12pt; color: rgb(0, 0, 0);">cfg.channel = 'eeg';</span></div>
<span style="font-family: "Courier New", monospace; font-size: 12pt; color: rgb(0, 0, 0);">ft_layoutplot(cfg, mydata_artrm_train);</span><br>
</div>
<div style=""><span style="font-family: "Courier New", monospace; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div style=""><span style="font-family: "Courier New", monospace; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div style=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Any ideas what could be the issue here and how I could get it solved? </span></div>
<div style=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Thanks for your help in advance!</span></div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0"><span style="font-family:"Calibri Light","Helvetica Light",sans-serif">_________________________</span></p>
<span style="font-family:"Calibri Light","Helvetica Light",sans-serif"></span>
<p style="margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0"><span style="font-family:"Calibri Light","Helvetica Light",sans-serif">Marta Topor</span></p>
<span style="font-family:"Calibri Light","Helvetica Light",sans-serif"></span>
<p style="margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0"><span style="color:rgb(0,0,0); font-family:"Calibri Light","Helvetica Light",sans-serif">PhD Candidate</span></p>
<p style="margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0"><span style="color:rgb(0,0,0); font-family:"Calibri Light","Helvetica Light",sans-serif"><span style="font-family:"Calibri Light","Helvetica Light",sans-serif; font-size:16px">Room
 07AC04</span><br>
</span></p>
<span style="font-family:"Calibri Light","Helvetica Light",sans-serif"></span>
<p style="margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0"><span style="color:rgb(0,0,0); font-family:"Calibri Light","Helvetica Light",sans-serif">School of Psychology</span></p>
<p style="margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0"><span style="color:rgb(0,0,0); font-family:"Calibri Light","Helvetica Light",sans-serif">University of Surrey </span></p>
<span style="font-family:"Calibri Light","Helvetica Light",sans-serif"></span>
<p style="margin-top:0px; margin-bottom:0px; margin-top:0; margin-bottom:0"><span style="color:rgb(0,0,0); font-family:"Calibri Light","Helvetica Light",sans-serif"><br>
</span></p>
</div>
</div>
</div>
</div>
</body>
</html>