<div style="font-size:1em;font-family:Helvetica,arial,freesans,clean,sans-serif;color:rgb(34,34,34);background-color:rgb(255,255,255);border:medium none;line-height:1.2" class="markdown-here-wrapper" id="markdown-here-wrapper-681944">
<p style="margin:1em 0px">Hello,</p>
<p style="margin:1em 0px">Is it possible filter in-memory extracted trials data with mirroring at the edges?</p>
<p style="margin:1em 0px">When I try:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;overflow:auto;margin:1em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px 3px 3px 3px;display:inline;white-space:pre;border-radius:3px 3px 3px 3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block;padding:0.5em;color:rgb(51,51,51);background:none repeat scroll 0% 0% rgb(248,248,255)" class="language-matlab"><span style="color:rgb(153,153,136);font-style:italic" class="comment">% filter</span>
cfg = <span class="matrix">[]</span>;
<span class="transposed_variable">cfg.</span>lpfilter = <span style="color:rgb(221,17,68)" class="string">'yes'</span>;
<span class="transposed_variable">cfg.</span>lpfreq = <span style="color:rgb(221,17,68)" class="string">'40'</span>;
<span class="transposed_variable">cfg.</span>lpfilttype = <span style="color:rgb(221,17,68)" class="string">'but'</span>;
<span class="transposed_variable">cfg.</span>padtype = <span style="color:rgb(221,17,68)" class="string">'mirror'</span>;
<span style="color:rgb(153,153,136);font-style:italic" class="comment">% trial length is 1.1s so mirror-pad to 1.5s (200ms each side)</span>
<span class="transposed_variable">cfg.</span>padding = <span style="color:rgb(0,153,153)" class="number">1.5</span>;
flt_data = ft_preprocessing(cfg, block_data);</code></pre>
<p style="margin:1em 0px">I get:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;overflow:auto;margin:1em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px 3px 3px 3px;display:inline;white-space:pre;border-radius:3px 3px 3px 3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block;padding:0.5em;color:rgb(51,51,51);background:none repeat scroll 0% 0% rgb(248,248,255)">Reference to non-existent field 'Fs'.

Error in ft_preprocessing (line 288)
      padding = round(cfg.padding * data.Fs);</code></pre>
<p style="margin:1em 0px">Adding <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px 3px 3px 3px;display:inline">block_data.Fs = block_data.fsample;</code> seems to work. But in the resulting data structure the time vectors no longer match the trial data, so obviously something is going wrong:</p>

<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;overflow:auto;margin:1em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px 3px 3px 3px;display:inline;white-space:pre;border-radius:3px 3px 3px 3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block;padding:0.5em;color:rgb(51,51,51);background:none repeat scroll 0% 0% rgb(248,248,255)">>> size(block_data.time{1})

ans =

     1   560

>> size(block_data.trial{1})

ans =

   234   560

>> size(flt_data.trial{1})

ans =

   234   560

>> size(flt_data.time{1})

ans =

     1   357</code></pre>
<p style="margin:1em 0px">Is there a correct way to do this? (Filter trials with mirrored edges)</p>
<p style="margin:1em 0px">Thanks,</p>
<p style="margin:1em 0px">Robin</p>
</div>