[FieldTrip] Downsampling Issue

Eleanor Moses eleanor.moses at uq.net.au
Fri May 13 04:18:30 CEST 2022

Hi Jan-Mathijs,

thankyou for your reply. This is what I get (just the one version).

>> which ft_resampledata
C:\Users\Ellie\AppData\Roaming\MathWorks\MATLAB Add-Ons\Collections\fieldtrip-20220426\ft_resampledata.m

I have also added the relevant fieldtrip directories using ft_defaults.


Eleanor Moses BPsych(Hons)
PhD Candidate
School of Psychology
The University of Queensland
Brisbane QLD 4072 Australia
Email: eleanor.moses at uqconnect.edu.au

From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Schoffelen, J.M. (Jan Mathijs) via fieldtrip <fieldtrip at science.ru.nl>
Sent: 12 May 2022 00:36
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Cc: Schoffelen, J.M. (Jan Mathijs) <janmathijs.schoffelen at donders.ru.nl>
Subject: Re: [FieldTrip] Downsampling Issue

Hi Eleanor,

Could it be that you have an unexpected version of resampledata on your matlab path? What do you get if you type which resampledata on the matlab command line?

Best wishes,

On 11 May 2022, at 10:45, Eleanor Moses via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear community,

I am new to fieldtrip and am trying to preprocess my EEG data so that it was be compatible with later analysis using cosmomvpa.
However, I keep running into the same error with the ft_resampledata function.

When I attempt to downsample, this is the error I get

Check for incorrect argument data type or missing argument in call to function 'resample'.

Error in ft_resampledata (line 231)
        newdat = transpose(resample(transpose(olddat),fsres,fsorig));

Error in Fieldtrip_Test (line 27)
data_eeg = ft_resampledata(cfg, data_eeg);

I have checked previous posts to the community, to check that I am not encourting previously posted errors (I am downsampling from 1024Hz to 512, or have tried to 256, so this is a neat integer division which was a problem previously discussed that produced this error with ft_resampledata).
I have ensured that I have specified all necessary configurations (cfg.resamplefs = 512; cfg.detrend = 'no';) and aside from this am using the default configurations.
When I remove the resampling section from my preprocessing pipeline script, it otherwise works fine, and works with mvpa functions from cosmomvpa.
I tried to apply the ft_resampledata function after the ft_preprocessing function as the help ft_resampledata notes indicate that data should be
resampled as obtained from the ft_preprocessing function, but encounter the same error even if I rearrange when I use ft_resampledata (before pre-proc, right after importing data).

I also encounter this error when I try to run tutorial fieldtrip preprocessing scripts that I have downloaded from the cosmomvpa website - so the error isn't unique to my script.

I have included the data structure and cfg's for the function below.

% Raw data configuration
%            hdr: [1×1 struct]
%          label: {73×1 cell}
%           time: {[0 9.7656e-04 0.0020 0.0029 0.0039 0.0049 0.0059 0.0068 0.0078 0.0088 0.0098 0.0107 … ]}
%          trial: {[73×391168 double]}
%        fsample: 1024
%     sampleinfo: [1 391168]
%            cfg: [1×1 struct]

cfg = [];
cfg.resamplefs = 256;
cfg.detrend = 'no';
data_eeg = ft_resampledata(cfg, data_eeg);

Any help would be greatly appreciated, kind regards

Eleanor Moses

Eleanor Moses BPsych(Hons)
PhD Candidate
School of Psychology
The University of Queensland
Brisbane QLD 4072 Australia
Email: eleanor.moses at uqconnect.edu.au<mailto:eleanor.moses at uqconnect.edu.au>

fieldtrip mailing list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220513/cee56dbc/attachment.htm>

More information about the fieldtrip mailing list