[FieldTrip] Undefined function or variable "lab"

Poljac, E. (Ervin) ervin.poljac at donders.ru.nl
Mon Jul 27 13:54:00 CEST 2015

Hello fieldtrippers,

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:

Undefined function or variable "lab".

Error in channelposition (line 314)
n   = size(lab,2);

Error in ft_datatype_sens (line 329)
        [chanpos, chanori, lab] = channelposition(sens);

Error in ft_datatype_raw (line 146)
      data.elec = ft_datatype_sens(data.elec);

Error in ft_checkdata (line 225)
  data = ft_datatype_raw(data, 'hassampleinfo', hassampleinfo);

Error in ft_channelrepair (line 102)
data = ft_checkdata(data, 'datatype', 'raw', 'feedback', 'yes');

In the debug mode I see that the variable 'sense' 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.
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 ft_checkdata, ft_datatype_sens and ft_datatype_sens, they are different, but it is not obvious to me what exactly is new, causing the error.

Many thanks,

My code:

%% channel rejection, identifying bad channels for target condition
cfg.method = 'mtmfft';
cfg.output = 'pow';
cfg.taper  = 'hanning';
cfg.foi = [50];% frequency band - foilim or just foi??

idx=unique([find(rejectedData.powspctrm>0.5*10^4)]); %this threshold might change for each recording
cfg = [];
cfg.channel  = rejectedData.label;
cfg.layout = 'biosemi64.lay';
cfg.feedback = 'yes';
lay = ft_prepare_layout(cfg);

if ~isempty(idx)
[badchannels{1:numel(idx),1}] = deal(rejectedData.label{idx});

% Interpolation for rejected channels
dataTarget.elec.label = dataTarget.label;
dataTarget.elec.pnt = lay.pos;
dataTargetRepaired=ft_channelrepair(cfg, dataTarget);

Ervin Poljac, PhD
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognition (DCC)
Radboud University Nijmegen
Room B.00.78A Montessorilaan 3 6500 HE Nijmegen
T. 024 36 15457
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150727/81896053/attachment-0001.html>

More information about the fieldtrip mailing list