<HTML><HEAD>
<META content="text/html; charset=iso-8859-15" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.23588"></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Tahoma">
<DIV>Hi Irene,</DIV>
<DIV> </DIV>
<DIV>Here is the code I used:</DIV>
<DIV> </DIV>
<DIV>cfg = [];<BR>cfg.method = 'triangulation'<BR>cfg.senstype = 'EEG'<BR>neighbours_66 = ft_prepare_neighbours(cfg, data_intact);</DIV>
<DIV> </DIV>
<DIV>    cfg = [];<BR>    cfg.method = 'average';<BR>    cfg.neighbours = neighbours_66;<BR>    cfg.missingchannel = missingChann;<BR>    cfg.senstype = 'EEG';<BR>    data_clean = ft_channelrepair(cfg, data);</DIV>
<DIV> </DIV>
<DIV>Here is an example from Fieldtrip website <BR><A href="http://www.fieldtriptoolbox.org/tutorial/natmeg/timefrequency?s[]=ft&s[]=channelrepair">http://www.fieldtriptoolbox.org/tutorial/natmeg/timefrequency?s[]=ft&s[]=channelrepair</A></DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV> </DIV>
<DIV>Xiaoming</DIV>
<DIV><BR>>>> "Irene Sophia Mayer" <mi_mayer@gmx.de> 4/20/2016 3:07 AM >>><BR></DIV>
<DIV style="FONT-FAMILY: Verdana; FONT-SIZE: 12px">
<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 style="BORDER-LEFT: #c3d9e5 2px solid; PADDING-BOTTOM: 10px; MARGIN: 10px 5px 5px 10px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; WORD-WRAP: break-word; PADDING-TOP: 10px; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space" name="quote">
<DIV style="MARGIN: 0px 0px 10px"><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: 4px 4px 1px; FONT: 10pt 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: 12px">
<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>