<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;"><span style="font-size: 13.3333px;">Dear fieldtrip community,</span>
<div style="font-size: 13.3333px;"><br>
</div>
<div style="font-size: 13.3333px;">I have 128 channel EEG data collected from young infants in an ERP paradigm. Since the EEG data from young infants are noisier than adults, I tried to implement a trial by trial bad channel correction. If a trial has more
 than 20 bad channels, reject the trial altogether and if the number of bad channels are less than 20, interpolate the bad channels. I have implemented this using the following script. It seems to work, but when I load the file after this step, it takes a long
 time to load it (up to 20 minutes) and all subsequent processing takes very long time. Is there a way to fix this?</div>
<div style="font-size: 13.3333px;"><br>
</div>
<div style="font-size: 13.3333px;">Thank you,</div>
<div style="font-size: 13.3333px;">Varghese<br>
<div><br>
</div>
<div><br>
</div>
<div>
<div><font face="Courier New">indx=1;</font></div>
<div><font face="Courier New">BadChannelCriterion=100; </font></div>
<div><font face="Courier New">AllTrialsBadChannelLabels={};</font></div>
<div><font face="Courier New">datr={};</font></div>
<div><font face="Courier New">TrialNos=[];</font></div>
<div><font face="Courier New">for loop =1:length(I09_ADSStd_epochs2.trial),</font></div>
<div><font face="Courier New">    AllTrialsBadchannelIndex = find(max(abs(I09_ADSStd_epochs2.trial{loop}),[],2)>BadChannelCriterion);</font></div>
<div><font face="Courier New">    SingleTrialBadChannelLabels= I09_ADSStd_epochs2.label(AllTrialsBadchannelIndex );</font></div>
<div><font face="Courier New">    AllTrialsBadChannelLabels= [AllTrialsBadChannelLabels; SingleTrialBadChannelLabels];</font></div>
<div><font face="Courier New">    </font></div>
<div><font face="Courier New">     if length(find(max(abs(I09_ADSStd_epochs2.trial{loop}),[],2)>BadChannelCriterion))<20,</font></div>
<div><font face="Courier New">            BadchannelIndex = find(max(abs(I09_ADSStd_epochs2.trial{loop}),[],2)>BadChannelCriterion);</font></div>
<div><font face="Courier New">            BadchannelLabels=I09_ADSStd_epochs2.label(BadchannelIndex);</font></div>
<div><font face="Courier New">            cfg = [];</font></div>
<div><font face="Courier New">            cfg.layout= lay;</font></div>
<div><font face="Courier New">            cfg.badchannel = BadchannelLabels;</font></div>
<div><font face="Courier New">            cfg.method = 'spline';</font></div>
<div><font face="Courier New">            cfg.neighbours = EEG_neighbours;</font></div>
<div><font face="Courier New">            cfg.trials = loop;</font></div>
<div><font face="Courier New">            datr{indx} = ft_channelrepair(cfg,I09_ADSStd_epochs2);</font></div>
<div><font face="Courier New">            TrialNos(indx)=loop;</font></div>
<div><font face="Courier New">            indx=indx+1;</font></div>
<div><font face="Courier New">     end</font></div>
<div><font face="Courier New">end</font></div>
<div><font face="Courier New">cfg = [];</font></div>
<div><font face="Courier New">I09_ADSStd_epochs_clean = ft_appenddata(cfg, datr{:});</font></div>
</div>
</div>
</div>
</body>
</html>