<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Dear Fieldtrippers, 
<div><br>
</div>
<div>I need to interpolate my data to remove artifacts due to the electric stimulation at the moment of the trigger. So I wrote :</div>
<div><br>
</div>
<div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
<br>
</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">        cfg                     = [];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">        epData                  = ft_redefinetrial(epData_cfg, allData_prepross);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">        fname = [contfname];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">        save([subjPath filesep fname
<span style="color: #b245f3">'.mat'</span>], <span style="color: #b245f3">'epData'</span>);</div>
<p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px; ">
<br>
</p>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">        electric_windows = [0.002 0.013];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">        electric_window_idx = [nearest(epData.time{1},electric_window(1)) nearest(epData.time{1},electric_window(2))];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">        <span style="color: #0433ff">
for</span> i=1:numel(epData.trial) <span style="color: #25992d">% Loop through all trials</span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">            epData.trial{i}(:,electric_window_idx(1):electric_window_idx(2))=nan;
<span style="color: #25992d">% Replace the segment of data corresponding to our window of interest with nans</span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">        <span style="color: #0433ff">
end</span>;</div>
<p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px; ">
        <br class="webkit-block-placeholder">
</p>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">        cfg.method =
<span style="color: #b245f3">'linear'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">        cfg.prewindow   = 0.01;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">        cfg.postwindow  = 0.01;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">        interpoldata  = ft_interpolatenan(cfg, epData);</div>
<div><br>
</div>
<div>But I get the following error: </div>
<div>Undefined function 'electric_window' for input arguments of type 'double'.</div>
<div><br>
</div>
<div>Even if I see what the problem is, I don't know how to solve it without doing any mistakes.</div>
<div><br>
</div>
<div>Thank you!</div>
<div><br>
</div>
<div>Emilie </div>
<div apple-content-edited="true">
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<br>
</div>
</div>
<div><br>
</div>
<br class="Apple-interchange-newline">
</div>
<br>
</div>
</body>
</html>