[FieldTrip] error while removing ecg

Narjes Soltani na.so.ir at gmail.com
Sat Jan 14 15:12:49 CET 2017

Dear all


I am trying to remove ecg artifact from some neuromag MEG data using the “
ft_artifact_ecg” method, but unfortunately I encounter the following error:

"Undefined function or variable "labelmlt"."

When I traced the code, I found that the error is raised from
“ft_channelselection” method. In this method, line 340, the value of
variable "findmlt" is set to some index, in my code to 1, via the following
code snippet:

findmlt        = find(strcmp(channel, 'MLT'));

Then in line 428 of method “ft_channelselection”, the following line of
code produces the above error:

if findmlt,        channel = [channel; labelmlt]; end

I found that the only place in method “ft_channelselection” where variable “
labelmlt” is set is in line 249 which is not accessible in my code as it
seems to only be accessible for the CTF file format.

To solve the problem, I just copied lien 249 at the end of the switch case
statements, i.e. after line 298 as follows:

labelmlt  = datachannel(strncmp('MLT', *datachannel*, length('MLT')));

and I replaced the bold “*datachannel*" variable with “channel” variable
and this way the error was solved, but I am not really sure what I have
done is correct or not. Would you please help me with this issue?

I had the same problem with labelmrt and I solved it in the same way.

Besides, I wonder if there is any better and more straightforward way to
remove ECG artifact as even after solving the above errors, I have to
manually answer to the following line at each run:

current  zvalue threshold = 3.000

keep the current value (y/n) ?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170114/00ebd0bd/attachment-0001.html>

More information about the fieldtrip mailing list