[FieldTrip] ft_channelrepair: index exceeds matrix dimensions

Xiaoming Du XDu at mprc.umaryland.edu
Tue Apr 19 20:38:10 CEST 2016

I am not a fieldtrip expert, but I happen to use ft_channelrepair recently. 
In you code,  does the 'data' have FT9 or CP6? Are those electrodes missing or bad? If you construct neighbours based on less number of electrodes, you may still lack the neighbour-info to interpolate them. 
I suggest to check the dimension of neighbours and see if it contains the neighbours info for all electrodes (especially for FT9 and CP6). 
Also, you can try cfg.missingchannel instead of cfg.badchannel and see if that helps.
p.s., in my case, I used a good data (meaning without missing or bad channels) to create the neighbours and use it for all others dataset with same type of EEG caps. 

>>> "Irene Sophia Mayer" <mi_mayer at gmx.de> 4/19/2016 2:07 PM >>>
Dear fieldtrippers, 
When trying to repair bad channels, I get the following error message: 
Index exceeds matrix dimensions.
Error in ft_channelrepair (line 177)
      goodsensindx = a(b);
Error in prepro_neu (line 129)
    data = ft_channelrepair(cfg,data);
This seems to happen for specific channels, e.g. 'FT9' and 'CP6', but the script works fine, if I don't try to interpolate those channels. 
Any ideas what the problem could be?
My code: 
cfg    	    	    	 = [];
cfg.method    	    	  = 'template';
cfg.layout    	    	  = 'EEG1010.lay';
cfg.feedback    	    	= 'yes';
neighbours = ft_prepare_neighbours(cfg,data);
cfg    	    	    	 = [];
cfg.method    	    	  = 'average'; % 'nearest', 'average', 'spline' or 'slap' (default='nearest')
cfg.badchannel    	      = bad_chan{x}; % predefined list of channels
cfg.elec    	    	    = ft_read_sens('path');
cfg.neighbours    	      = neighbours;
cfg.trials    	    	  = 'all';
cfg.lambda    	    	  = 1e-5;
cfg.order    	    	   = 4;
data = ft_channelrepair(cfg,data);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160419/fd075f2e/attachment-0002.html>

More information about the fieldtrip mailing list