<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Gunnar,<div><br></div><div>This is a known challenge, especially for large datasets. Your considerations for the filtering during preprocessing are well taken. Since different resampling methods can be used with either integer or fractional resamling ratio's, it is not completely straightforward for to specify how the old and new samples map to each other. </div><div><br></div><div>However, a trick is to add a channel to your original data that contains the sample indices of the original dataset. E.g.</div><div><br></div><div>cfg = []</div><div>cfg = …</div><div>data_old = ft_preprocessing(cfg)</div><div><br></div><div>data_old.label{end+1} = ‘sample’;</div><div>for i=1:size(data_old.sampleinfo,1)</div><div> % this works for one or more trials</div><div> data_old.trial{i}(end+1,:) = data_old.sampleinfo(i,1):data_old.sampleinfo(i,2);</div><div>end</div><div><br></div><div>cfg = []</div><div>cfg = …</div><div>data_new = ft_resampledata(cfg, data_old);</div><div><br></div><div>The effect is that the linearly increasing sample channel also gets downsampled. In data_new you can subsequently look up the mapping between the new (index) and the old (value) samples. </div><div><br></div><div>best regards,</div><div>Robert</div><div><br></div><div><br></div><div><br></div><div><br><div><div>On 17 Mar 2016, at 08:36, Gunnar Norrman <<a href="mailto:gunnar.norrman@biling.su.se">gunnar.norrman@biling.su.se</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr" style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif;"><div style="margin-top: 0px; margin-bottom: 0px;">Hello,</div><div style="margin-top: 0px; margin-bottom: 0px;"><br></div><div style="margin-top: 0px; margin-bottom: 0px;">I have a set of BioSemi EEG data that I want to import, downsample and high pass filter as continuous data before epoching. However, when I load the original triggers from the .bsd file they are still in the original sample frequency, and when I want to apply the trials (extracted using ft_definetrial) using ft_redefinetrial, I get the following error:</div><div style="margin-top: 0px; margin-bottom: 0px;"><br></div><div style="margin-top: 0px; margin-bottom: 0px;">> In ft_redefinetrial (line 222)</div><div style="margin-top: 0px; margin-bottom: 0px;">Subscripted assignment dimension mismatch.</div><div style="margin-top: 0px; margin-bottom: 0px;"><br></div><div style="margin-top: 0px; margin-bottom: 0px;">Now, the obvious solution would be to downsample the data<span class="Apple-converted-space"> </span><em>after</em><span class="Apple-converted-space"> </span>epoching, of course, but then highpass filtering (in the original sample rate) takes a very long time to complete. I also want to save the continuous, filtered and downsampled data before epoching for plotting.</div><div style="margin-top: 0px; margin-bottom: 0px;"><br></div><div style="margin-top: 0px; margin-bottom: 0px;">Any suggestions? Is there any way to change the sample rate of the trial definitions, or to load the continuous data<span class="Apple-converted-space"> </span><em>including</em><span class="Apple-converted-space"> </span>trial information prior to downsampling?</div><div style="margin-top: 0px; margin-bottom: 0px;"><br></div><div style="margin-top: 0px; margin-bottom: 0px;">Thank you!</div><div style="margin-top: 0px; margin-bottom: 0px;"><br></div><div style="margin-top: 0px; margin-bottom: 0px;">Best regards,</div><div style="margin-top: 0px; margin-bottom: 0px;">Gunnar Norrman<span class="Apple-converted-space"> </span><br></div><div style="margin-top: 0px; margin-bottom: 0px;"><br></div><div id="Signature"><div name="divtagdefaultwrapper" style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif;"><font face="Times New Roman"></font><div style="margin: 0cm 0cm 0pt;"><span lang="EN-US" style="color: gray; font-family: 'Courier New'; font-size: 10pt;">---</span></div><font face="Times New Roman"></font><div style="margin: 0cm 0cm 0pt;"><span lang="EN-US" style="color: gray; font-family: 'Courier New'; font-size: 10pt;">Gunnar Norrman</span></div><font face="Times New Roman"></font><div style="margin: 0cm 0cm 0pt;"><span lang="EN-US" style="color: gray; font-family: 'Courier New'; font-size: 10pt;">Centre for Research on Bilingualism, Stockholm University</span></div><font face="Times New Roman"></font><div style="margin: 0cm 0cm 0pt;"><span lang="EN-US" style="color: gray; font-family: 'Courier New'; font-size: 10pt;">+46 (0)8 16 3643 |<span class="apple-converted-space"> </span><a id="NoLP" href="mailto:gunnar.norrman@biling.su.se"><span style="color: gray;">gunnar.norrman@biling.su.se</span></a></span></div><font face="Times New Roman"></font></div></div>_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div></blockquote></div><br></div></body></html>