<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Hello, </div>

<div> </div>

<div>The data does always have those channels, they are bad and not missing. All electrodes have neighbours assigned to them and I'm doing this on the original data without having changed anything before that. </div>

<div> </div>

<div>Did you use the same code as I did?</div>

<div> </div>

<div>Best, </div>

<div>Irene</div>

<div> 
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Dienstag, 19. April 2016 um 20:38 Uhr<br/>
<b>Von:</b> "Xiaoming Du" <XDu@mprc.umaryland.edu><br/>
<b>An:</b> fieldtrip@science.ru.nl<br/>
<b>Betreff:</b> Re: [FieldTrip] ft_channelrepair: index exceeds matrix dimensions</div>

<div name="quoted-content">
<div style="MARGIN: 4.0px 4.0px 1.0px;FONT: 10.0pt Tahoma;">
<div>Hello,</div>

<div> </div>

<div>I am not a fieldtrip expert, but I happen to use ft_channelrepair recently.</div>

<div> </div>

<div>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.</div>

<div> </div>

<div>I suggest to check the dimension of neighbours and see if it contains the neighbours info for all electrodes (especially for FT9 and CP6).</div>

<div> </div>

<div>Also, you can try cfg.missingchannel instead of cfg.badchannel and see if that helps.</div>

<div> </div>

<div>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.</div>

<div> </div>

<div>Best,</div>

<div> </div>

<div>Xiaoming<br/>
<br/>
>>> "Irene Sophia Mayer" <mi_mayer@gmx.de> 4/19/2016 2:07 PM >>></div>

<div style="FONT-FAMILY: Verdana;FONT-SIZE: 12.0px;">
<div>Dear fieldtrippers, </div>

<div> </div>

<div>When trying to repair bad channels, I get the following error message: </div>

<div> </div>

<div>
<div><span style="FONT-FAMILY: courier new , courier , monospace;">Index exceeds matrix dimensions.</span></div>

<div><span style="FONT-FAMILY: courier new , courier , monospace;">Error in ft_channelrepair (line 177)<br/>
      goodsensindx = a(b);</span></div>

<div><span style="FONT-FAMILY: courier new , courier , monospace;">Error in prepro_neu (line 129)<br/>
    data = ft_channelrepair(cfg,data);</span></div>

<div> </div>

<div>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. </div>

<div> </div>

<div>Any ideas what the problem could be?</div>

<div> </div>

<div>My code: </div>

<div>
<div><span style="FONT-FAMILY: courier new , courier , monospace;">cfg                         = [];<br/>
cfg.method                  = 'template';<br/>
cfg.layout                  = 'EEG1010.lay';<br/>
cfg.feedback                = 'yes';</span></div>

<div><span style="FONT-FAMILY: courier new , courier , monospace;">neighbours = ft_prepare_neighbours(cfg,data);</span></div>

<div> </div>

<div><span style="FONT-FAMILY: courier new , courier , monospace;">cfg                         = [];<br/>
cfg.method                  = 'average'; % 'nearest', 'average', 'spline' or 'slap' (default='nearest')<br/>
cfg.badchannel              = bad_chan{x}; % predefined list of channels<br/>
cfg.elec                    = ft_read_sens('path');<br/>
cfg.neighbours              = neighbours;<br/>
cfg.trials                  = 'all';<br/>
cfg.lambda                  = 1e-5;<br/>
cfg.order                   = 4;</span></div>

<div><span style="FONT-FAMILY: courier new , courier , monospace;">data = ft_channelrepair(cfg,data);</span></div>
</div>
</div>
</div>
_______________________________________________ fieldtrip mailing list fieldtrip@donders.ru.nl <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div>
</div>
</div>
</div>
</div></div></body></html>