[FieldTrip] ft_resampledata error 'Matrix dimensions must agree'

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Thu May 12 11:46:12 CEST 2016

If your purpose is just to detrend, I would use ft_preprocessing:

cfg = [];
cfg.detrend = ‘yes’;
data = ft_preprocessing(cfg, data);

ft_resampledata is for resampling (what’s in a name), and allows for optional detrending prior to the downsampling (because a large trend may lead to edge artifacts upon the downsampling).


PS: I would also recommend to review your path settings, since you get some warnings about octave functions

On 12 May 2016, at 11:02, shiri makov <mkshiri at gmail.com<mailto:mkshiri at gmail.com>> wrote:

Dear community,

My name is Shiri and I am a student at Tel-Aviv Univesrity. I study perception during sleep using EEG. Currently I am analysing EEG data collected with EGI system.

I tried using ft_resampledata to detrend the data. The weird thing is that sometimes when I call ft_resampledata, I get an error message:

the input is raw data with 8 channels and 60 trials
resampling data
Octave functions should not run on Matlab
Removing path ...
Error using  .*
Matrix dimensions must agree.
Error in resample (line 71)
      h = p*firls( L-1, [0 2*fc 2*fc 1], [1 1 0 0]).*kaiser(L,bta)' ;
Error in ft_resampledata (line 208)
        data.trial{itr} =

As noted, this error appears only sometimes. If I run ft_resampledata again immidiately after receiving the error, it works well (same cfg, same data).
The error always happens when I call the function within a parfor loop. It almost never happens when I run the function line individually, without preceeding script lines.

The cfg I use is very basic:

>> display(cfg);

cfg =

    detrend: 'yes'

It happened to me on many data structs, so I share a link with just one of them (http://www.filedropper.com/dataexample).  Here too, I got the error and right after that I ran the function line again and  worked well.

I don't think it's ok to live in peace with this function erroring from time to time, can someone tell me what this error means? Did I not use the function correctly?



fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160512/2125762a/attachment-0002.html>

More information about the fieldtrip mailing list