[FieldTrip] a question in neighbours and channelrepair

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Fri Mar 4 13:13:08 CET 2022


Hi Masoud,

I don’t know why the whole story about neighbours would be relevant to the problem you are facing. Clearly, the error you report:

Error in ft_channelrepair (line 204)
cfg.missingchannel = setdiff(cfg.missingchannel, data.label, 'stable');

is caused by an issue with the call to the matlab builtin setdiff function. In other words, there is something unexpected going on with the cfg.missingchannel/data.label combo. Have you tried to debug this by setting a breakpoint on line 204 in ft_channelrepair and investigate cfg.missingchannel, and data.label at that point during code execution?

Best wishes,

Jan-Mathijs





On 4 Mar 2022, at 12:20, masoud via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hello again. Sorry for bothering you again, I know you are probably very busy but I Would appreciate it if you take your time and answer my question, I have been stuck in it for a while and just a little insight from you might help me overcome this problem.
sincerely Masoud


---------- Forwarded message ---------
From: masoud <masoudheshmatibnd at gmail.com<mailto:masoudheshmatibnd at gmail.com>>
Date: Mon, Feb 28, 2022 at 12:05 PM
Subject: a question in neighbours and channelrepair
To: <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>>


Hello, I am currently using the fieldtrip matlab toolbox for preprocessing an EEG dataset. I want to interpolate the CZ channel with its neighbours, all three methods of  ft_prepare_neighbours  function have been used.
1- I used the distance method in  ft_prepare_neighbours function but the output is:
Warning: no neighbours found for CZ
 In ft_prepare_neighbours at line 384

Warning: No neighbouring channels were specified or found
 In ft_prepare_neighbours at line 390           (I changed the value of cfg.neighbourdist multiple times but no changes has occurred)

2- The output of the triangulation method is:
Error using delaunay
At least three input points must be provided to define a triangular mesh.            (how can i provide these inputs?)

Error in ft_prepare_neighbours (line 275)
    tri = delaunay(prj(:,1), prj(:,2));

3- for the template method I made a custom neighbourhood templated with the file that you have shared on github, it works fine and I even tested it through ft_neighbourplot and the answer was still correct, the output of ft_neighbourplot was:
Selected channel CZ, which has 8 neighbours: FC1, FCZ, FC2, C1, C2, CP1, CPZ, CP2
But when I tried ft_channelrepair function the output was:
Error using cell/unique>celluniqueR2012a (line 249)
Elements of cell array input A must be character vectors (row vectors of class char).

Error in cell/unique (line 142)
        [varargout{1:nlhs}] = celluniqueR2012a(varargin{1},logical(flaginds(1:5)));

Error in cell/setdiff>cellsetdiffR2012a (line 303)
    uA = unique(a,order);

Error in cell/setdiff (line 129)
        [varargout{1:nlhs}] = cellsetdiffR2012a(varargin{1:2},logical(flaginds(1:3)));

Error in ft_channelrepair (line 204)
cfg.missingchannel = setdiff(cfg.missingchannel, data.label, 'stable');

the summary of the code is:
cfg.channel = {'CZ'};
cfg.method = 'template';
cfg.layout = 'layout.mat';
cfg.template = 'neighbours.mat';
neighbours = ft_prepare_neighbours(cfg, data);
cfg.badchannel     = 'CZ';
cfg.method         = 'average';
cfg.neighbours     = neighbours;
data_fixed = ft_channelrepair(cfg,data);

Would you mind please helping me with this problem?
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!7J-GWl1FRMyylcZ8EyMmtqcsY-npPVZs5F--2d_meEi2wnFb-s_WwEzKCv5mN4elJChFq79C3UeJbYf60OZouaJGALqd-AM_EdayYQ$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220304/36239343/attachment.htm>


More information about the fieldtrip mailing list