Hi guys,<div><br></div><div>I'm struggling with my attempts to interpolate channel data for some bad channels. I put in the following code:</div><div><br></div><div><code></div><div>    cfg=[];</div><div>    cfg.badchannel = 15;</div>

<div>    cfg.missingchannel = [];</div><div>    cfg.neighbours = neighbours;</div><div>    cfg.trials = <span class="s1">'all'</span>;</div><div>    cleanchdata = ft_channelrepair(cfg,cleandata);</div><div><p></p>




<div></code></div><div>the function the displays the following:</div><div><div><br></div><div>    "the input is raw data with 157 channels and 80 trials</div><div>    repairing channel AG015</div><div><span class="Apple-tab-span" style="white-space:pre">       </span>    using neighbour AG010</div>

<div><span class="Apple-tab-span" style="white-space:pre">      </span>    using neighbour AG014</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>    using neighbour AG062</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>    using neighbour AG092"</div>

</div><div><br></div><div>suggesting that neighbours have been selected successfully.</div><div><br></div><div>but a call to chdata.trial(1){15,:) just returns a bunch of NaNs rather than interpolated data I need.</div><div>

<br></div><div>I found another email thread similar to this but that solution doesn't seem to apply to me as the neighbours seemed to have been selected successfully. </div><div><br></div><div>The other interesting caveat is that ft_channelrepair seems to work fine if i run it without having run pca (to reject eyeblink and heartbeat components) beforehand.</div>

<div><br></div><div>The code for the component analysis and the subsequent rejection are in separate loops. The PCA is saved into a .mat file and then loaded again when i'm ready to reject the bad components. But for simplicity's sake the important code looks like this.</div>

<div><br></div><div><code></div><div>    % principle component analysis run with 32 components</div><div>    cfg = [];</div><div>    cfg.channel = (1:157);</div><div>    cfg.runica.pca=32;                </div><div>

    pca_data = ft_componentanalysis(cfg,data);</div><div><br></div><div>    % view components in order to select bad ones</div><div>    cfg = [];</div><div><span class="s1">    cfg.layout = layout; </span>% specify the layout file that should be used for plotting</div>

<div>    cfg.viewmode = <span class="s2">'component'</span>;</div><div>    ft_databrowser(cfg, pca_data);</div><div>    waitfor(gcf); </div><div><br></div><div>    % type bad components as user input </div><div>    % for example: if runica002 and runica0003 should be rejected, type "2,3" into the dialogue box</div>

<div>    badcomps = inputdlg({<span class="s2">'Bad Components:'</span>});</div><div>    badcomps = str2double(csv2cell(badcomps{1}));</div><div><br></div><div>    % reject bad components</div><div>    cfg = [];</div>

<div>    cfg.component = badcomps; </div><div>    cleandata = ft_rejectcomponent(cfg,pca_data);</div><div></code></div><div><br></div><div>the variable 'cleandata'  i get out from this code is the same cleandata i put in to ft_channelrepair.</div>

<div><br></div><div>Are there any ideas as to what I've done wrong here? Let me know if I need to give you guys more information.</div><div><br></div><div>Thanks for your help,</div><div>Keith</div><div><br></div>-- <br>

<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Keith Doelling<div>Lab Manager and Research Assistant</div><div>David Poeppel Lab</div><div>New York University</div>

</span><br>
</div>