[FieldTrip] Downsampling Issue

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Wed May 11 16:36:19 CEST 2022


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,
Jan-Mathijs

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
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!6_puilsIXBSl-VOPdSiXILpOMezgn_ng1hMy0gaxjp0fc3pv8jiBwG1L_o4YBZTBM2aSjSABeEueTp4obfl-YYHVJS2isgYDW59U3Q$

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


More information about the fieldtrip mailing list