<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Yasir,
<div class=""><br class="">
</div>
<div class="">The motivation for using ft_resampledata is not clear to me, neither is it clear how you actually called the function (cfg details etc).</div>
<div class="">Have you tried diagnosing this a bit more yourself, by specifying a breakpoint in the code, or by using the ‘dbstop if error’ command?</div>
<div class="">Given the information provided there is not much to say at the moment.</div>
<div class=""><br class="">
</div>
<div class="">With respect to your second quesion: it depends…</div>
<div class=""><br class="">
</div>
<div class="">Some computations to be accurate require double precision representation in memory.</div>
<div class=""><br class="">
</div>
<div class="">If you downsample too  much, you might lose temporal detail.</div>
<div class=""><br class="">
</div>
<div class="">Good luck</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 2 Feb 2023, at 18:56, Yasir Çatal via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div dir="ltr" class="">Hello FieldTrip community,
<div class=""><br class="">
</div>
<div class="">When I run ft_resampledata, I get the following error:</div>
<div class=""><br class="">
</div>
<div class="">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Error using signal.internal.resample.nonUniformParser>getSamples<br class="">
The number of elements of Tx must match the number of rows of X when X is a matrix<br class="">
Error in signal.internal.resample.nonUniformParser (line 23)<br class="">
[x, tx] = getSamples(xIn,tx1,Dim);<br class="">
Error in resample>nonUniformResample (line 268)<br class="">
[x, tx, tGrid, fs, p, q] = signal.internal.resample.nonUniformParser(isDimValSet,Dim,m,xIn,varargin{:});<br class="">
Error in resample (line 214)<br class="">
            nonUniformResample(isDimValSet,Dim, m, method1, dimIn, xIn, ...<br class="">
Error in ft_resampledata (line 253)<br class="">
        newdat = transpose(resample(transpose(olddat),fsres,fsorig));</blockquote>
<div class=""><br class="">
</div>
<div class="">I searched the mailing list and found a similar error from another user: <a href="https://mailman.science.ru.nl/pipermail/fieldtrip/2020-June/040130.html" class="">[FieldTrip] Errors with downsampling and artifact rejection (ru.nl)</a></div>
</div>
<div class=""><br class="">
</div>
<div class="">The solution for him was using an integer division of the original sampling rate (1000 -> 250 or 200). However, my data has a sampling rate of  508.6275 (HCP-MEG data, rmegpreproc output) which I'm afraid doesn't have a nice integer division.
 I tried with a couple of different cfg.resamplerefs but none of them worked.</div>
<div class=""><br class="">
</div>
<div class="">My second question is a more general one. For memory-efficient processing, which one is a better option: using single data type or downsampling but keeping it double precision.</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">Yasir</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!6QuchDjlTP1en2wbDVO-tCS33xH_IKoYp8GFfJ7E2RLCnqX7t13ucFwg1Qn_8OnacoX5c_pGDhnqVIJLVc57Ck6zxNONnq_mTiCWNA$
<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>