[FieldTrip] Downsampling Issue

Eleanor Moses eleanor.moses at uq.net.au
Wed May 11 10:45:21 CEST 2022

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

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

More information about the fieldtrip mailing list