[FieldTrip] Issues with ft_math function

Marion Vincent marion.vincent at univ-lille.fr
Mon Jan 20 17:02:01 CET 2020

Dear Fieldtrip users, 

I'm runing into soe issues when using the ft_math function.

%% ** Remove baseline
        active_LF_corrected = cell(1,4);
        active_HF_corrected = cell(1,4);
        for cond=numCond
            cfg = [];
            cfg.parameter = 'powspctrm';
            %cfg.operation = 'x1./x2 - 1'; % this will express the power as a relative change, i.e. a percentage deviating from 0.
            cfg.operation = '10*log10(x1./x2)';
            active_LF_corrected{cond-4} = ft_math(cfg, active_LF{cond-4}, baseline_LF{cond-4});
            active_HF_corrected{cond-4} = ft_math(cfg, active_HF{cond-4}, baseline_HF{cond-4});

I try to remove a baseline (baseline_LF) from my trial (active_LF), in the time frequency domain.
When I proces my data, for certain active and baseline matrices, the script works (see below). 
However in some cases, my active_LF_corrected ends up empty for the frequencies, and thus for the power spectrum.
For example, I get the following structure:
        label: {128×1 cell}
         freq: [1×0double]
         time: [1×201 double]
    powspctrm: [128×0×201 double]
          cfg: [1×1 struct]
       dimord: 'chan_freq_time'

And the saved matrix is :

        label: {128×1 cell}
         freq: []
         time: [1×201 double]
    powspctrm: []
          cfg: [1×1 struct]
       dimord: 'chan_freq_time'

I've checked the active_LF and baseline_LF structures, and they are ok: the freq dimension is [1x15 double] as it should be (and so is the powspctrm variable) .

Do you have any idea why the freq and powspctrm are empty in some cases only ? Where could it comes from ?


More information about the fieldtrip mailing list