<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body style="word-wrap:break-word" fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div>
<div style="font-family:Tahoma; font-size:13px">
<div>Hi Jan-Mathijs,</div>
<div><br>
</div>
<div>Thanks for your answer, one of my colleagues indeed suggested that I should look at data.elec.label and it seems that there are two additional labels ('<font face="Calibri" size="2"><span style="font-size: 9pt;">COMNT' and </span></font><font face="Calibri" size="2"><span style="font-size: 9pt;">'SCALE'.</span></font> ),
 so after removing them, the ft_channelrepair function worked.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Ervin</div>
<div><br>
</div>
<p class="MsoNormal">--</p>
<p class="MsoNormal"></p>
<p class="MsoNormal">Ervin Poljac, PhD </p>
<p class="MsoNormal">Donders Institute for Brain, Cognition and Behaviour </p>
<p class="MsoNormal">Centre for Cognition (DCC) </p>
<p class="MsoNormal">Radboud University Nijmegen </p>
<p class="MsoNormal">Room B.00.78A Montessorilaan 3 6500 HE Nijmegen </p>
<p class="MsoNormal">T. 024 36 15457</p>
</div>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF139854" style="direction: ltr;"><font face="Tahoma" size="2" color="#000000"><b>From:</b> fieldtrip-bounces@science.ru.nl [fieldtrip-bounces@science.ru.nl] on behalf of Schoffelen, J.M. (Jan Mathijs) [jan.schoffelen@donders.ru.nl]<br>
<b>Sent:</b> Monday, August 03, 2015 9:56 AM<br>
<b>To:</b> FieldTrip discussion list<br>
<b>Subject:</b> Re: [FieldTrip] Undefined function or variable "lab"<br>
</font><br>
</div>
<div></div>
<div>Hi Ervin,
<div><br>
</div>
<div>Given the information provided, it’s still hard to tell what might be going on. What version of FieldTrip are you using, and what does dataTarget.elec look like? What do your colleagues have to say about this? (The reason for the last question is, that
 they most likely have most hands-on experience with the quirks of the particular dataformat you are working with, and thus will be able to provide more specific input than the people who occasionally read posts on this list).</div>
<div>Also, the statement that an ‘older version of fieldtrip works’ is quite unspecific (e.g. are your colleagues using a 2009-version of the code, or a more recent one :o)? Is there code totally unmodified, or did they made some code changes in order for it
 to work?), so I don’t think that this is going to bring you close to a solution. Yet, I think it is good diagnostic information to know that somewhere in the past ‘it’ seemed to work, either with or without local changes. Would it make sense for you to team
 up with your colleagues to find on what’s going on?</div>
<div><br>
</div>
<div>Best,</div>
<div>Jan-Mathijs</div>
<div><br>
</div>
<div><br>
<br>
<div>
<div style="word-wrap:break-word">
<div style="word-wrap:break-word">
<div style="word-wrap:break-word">Jan-Mathijs Schoffelen, MD PhD, Senior researcher
<div><br>
Max Planck Institute for Psycholinguistics<br>
Donders Centre for Cognitive Neuroimaging</div>
<div><br>
E-mail: <a href="mailto:j.schoffelen@donders.ru.nl" target="_blank">j.schoffelen@donders.ru.nl</a><br>
Telephone: +31-24-3614793<br>
<br>
<a href="http://www.hettaligebrein.nl" target="_blank">http://www.hettaligebrein.nl</a></div>
<div><a href="http://www.fieldtriptoolbox.org" target="_blank">http://www.fieldtriptoolbox.org</a></div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
<div>
<div>On Jul 31, 2015, at 2:00 PM, Poljac, E. (Ervin) <<a href="mailto:ervin.poljac@donders.ru.nl" target="_blank">ervin.poljac@donders.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div style="font-family:Calibri; font-size:15px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<div style="direction:ltr; font-family:Tahoma; font-size:10pt">
<div>
<div style="font-family:Tahoma; font-size:13px">Anyone an idea of what might be wrong here?</div>
<div style="font-family:Tahoma; font-size:13px">Much appreciated,</div>
<div style="font-family:Tahoma; font-size:13px">Ervin</div>
</div>
<div style="font-family:'Times New Roman'; font-size:16px">
<hr tabindex="-1">
<div id="divRpF139146" style="direction:ltr"><font face="Tahoma" size="2"><b>From:</b><span class="Apple-converted-space"> </span><a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank">fieldtrip-bounces@science.ru.nl</a><span class="Apple-converted-space"> </span>[<a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank">fieldtrip-bounces@science.ru.nl</a>]
 on behalf of Poljac, E. (Ervin) [<a href="mailto:ervin.poljac@donders.ru.nl" target="_blank">ervin.poljac@donders.ru.nl</a>]<br>
<b>Sent:</b><span class="Apple-converted-space"> </span>Monday, July 27, 2015 1:54 PM<br>
<b>To:</b><span class="Apple-converted-space"> </span><a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a><br>
<b>Subject:</b><span class="Apple-converted-space"> </span>[FieldTrip] Undefined function or variable "lab"<br>
</font><br>
</div>
<div></div>
<div>
<div style="direction:ltr; font-family:Tahoma; font-size:10pt">Hello fieldtrippers,
<div><br>
</div>
<div>I am trying to prepare my EEG data for analysis. Among others, I identify bad channels and try to repair them. However, there is this annoying error:<br>
<div><br>
</div>
<div>
<div><font color="#ff0000"><i>Undefined function or variable "lab".</i></font></div>
<div><i><br>
</i></div>
<div><font color="#ff0000"><i>Error in channelposition (line 314)</i></font></div>
<div><font color="#ff0000"><i>n   = size(lab,2);</i></font></div>
<div><font color="#ff0000"><i><br>
</i></font></div>
<div><font color="#ff0000"><i>Error in ft_datatype_sens (line 329)</i></font></div>
<div><font color="#ff0000"><i>        [chanpos, chanori, lab] = channelposition(sens);</i></font></div>
<div><font color="#ff0000"><i><br>
</i></font></div>
<div><font color="#ff0000"><i>Error in ft_datatype_raw (line 146)</i></font></div>
<div><font color="#ff0000"><i>      data.elec = ft_datatype_sens(data.elec);</i></font></div>
<div><font color="#ff0000"><i><br>
</i></font></div>
<div><font color="#ff0000"><i>Error in ft_checkdata (line 225)</i></font></div>
<div><font color="#ff0000"><i>  data = ft_datatype_raw(data, 'hassampleinfo', hassampleinfo);</i></font></div>
<div><font color="#ff0000"><i><br>
</i></font></div>
<div><font color="#ff0000"><i>Error in ft_channelrepair (line 102)</i></font></div>
<div><font color="#ff0000"><i>data = ft_checkdata(data, 'datatype', 'raw', 'feedback', 'yes');</i></font></div>
</div>
<div><br>
</div>
<div>In the debug mode I see that the variable 'sens' has a correct value, the bad channel seems to be identified, but then for some reason, lab is not filled. I am copy-pasting that part of my code below.</div>
<div>I hope someone has experience with this and how to solve it. Some of my colleagues use an older fieldtrip version that works (so, no error there), and I compared the filein s <span style="font-size:10pt">ft_checkdata, </span><span style="font-size:10pt">ft_datatype_sens
 and </span><span style="font-size:10pt">ft_datatype_sens, they are different, but it is not obvious to me what exactly is new, causing the error.</span></div>
<div><br>
</div>
<div>Many thanks,</div>
<div>Ervin</div>
<div><br>
</div>
<div>My code:</div>
<div><br>
</div>
<div>
<div><font color="#008000">%% channel rejection, identifying bad channels for target condition</font></div>
<div><font color="#008000">cfg=[];</font></div>
<div><font color="#008000">cfg.method = 'mtmfft';</font></div>
<div><font color="#008000">cfg.output = 'pow';</font></div>
<div><font color="#008000">cfg.taper  = 'hanning';</font></div>
<div><font color="#008000">cfg.foi = [50];% frequency band - foilim or just foi??</font></div>
<div><font color="#008000">rejectedData=ft_freqanalysis(cfg,dataTarget);</font></div>
<div><span style="font-size:10pt"><font color="#008000"> </font></span></div>
<div><font color="#008000">idx=unique([find(rejectedData.powspctrm>0.5*10^4)]); %this threshold might change for each recording</font></div>
<div><font color="#008000">neighbours=open('/Users/Ervin/Documents/MATLAB/biosemi64_neighb.mat');</font></div>
<div><font color="#008000">neighbours=neighbours.neighbours;</font></div>
<div><font color="#008000">cfg = [];</font></div>
<div><font color="#008000">cfg.channel  = rejectedData.label;</font></div>
<div><font color="#008000">cfg.layout = 'biosemi64.lay';</font></div>
<div><font color="#008000">cfg.feedback = 'yes';</font></div>
<div><font color="#008000">lay = ft_prepare_layout(cfg);</font></div>
<div><font color="#008000"><br>
</font></div>
<div><font color="#008000">if ~isempty(idx)</font></div>
<div><font color="#008000">badchannels=cell(numel(idx),1);</font></div>
<div><font color="#008000">[badchannels{1:numel(idx),1}] = deal(rejectedData.label{idx});</font></div>
<div><font color="#008000"><br>
</font></div>
<div><font color="#008000">% Interpolation for rejected channels</font></div>
<div><font color="#008000">cfg=[];</font></div>
<div><font color="#008000">cfg.layout=lay;</font></div>
<div><font color="#008000">cfg.badchannel=badchannels;</font></div>
<div><font color="#008000">dataTarget.elec.label = dataTarget.label;</font></div>
<div><font color="#008000">dataTarget.elec.pnt = lay.pos;</font></div>
<div><font color="#008000">cfg.neighbours=neighbours;</font></div>
<div><font color="#008000">dataTargetRepaired=ft_channelrepair(cfg, dataTarget);</font></div>
<div><font color="#008000">end</font></div>
<div style="font-family:Tahoma; font-size:13px">
<p class="MsoNormal"><br>
</p>
<p class="MsoNormal">--</p>
<div><br class="webkit-block-placeholder">
</div>
<p class="MsoNormal">Ervin Poljac, PhD</p>
<p class="MsoNormal">Donders Institute for Brain, Cognition and Behaviour</p>
<p class="MsoNormal">Centre for Cognition (DCC)</p>
<p class="MsoNormal">Radboud University Nijmegen</p>
<p class="MsoNormal">Room B.00.78A Montessorilaan 3 6500 HE Nijmegen</p>
<p class="MsoNormal">T. 024 36 15457</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<br>
</div>
<br>
</div>
</div>
</div>
</body>
</html>