[FieldTrip] Reshape Error Using ft_freqstatistics

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Wed Sep 6 17:18:53 CEST 2017


Hi David,

Have you checked whether this could be due to a potential typo in the specification of your cfg.channel (e.g.: CZ versus Cz)?
Best,
Jan-Mathijs



On 6 Sep 2017, at 16:48, David <preted at mcmaster.ca<mailto:preted at mcmaster.ca>> wrote:

Hello everyone,

I am running into an error when I try to compute the cluster based permutation test in the frequency-time domain comparing baseline to when the stimulus is present. I’ve calculated the power for 300 milliseconds (1 millisecond is equal to one time point) before the onset of the stimulus and 300ms during the stimulus for a range of 10 frequencies. The error I’m running into is stated below as well as my code and I’ve attached an image of what the data looks like. I’ve tried following the tutorials and searching through the mailing list and can’t seem to find a solution.  Has anyone else run into this problem and found a solution or am I making an error somewhere in my analysis?


MY CODE:
    cfg = [];
    cfg.channel          = 'CZ';
    cfg.latency          = [0.1 0.4];
    cfg.method           = 'montecarlo';
    cfg.frequency        = 'all';
    cfg.statistic        = 'ft_statfun_actvsblT';
    cfg.correctm         = 'cluster';
    cfg.clusteralpha     = 0.05;
    cfg.clusterstatistic = 'maxsum';
    cfg.tail             = 0;
    cfg.clustertail      = 0;
    cfg.alpha            = 0.025;
    cfg.numrandomization = 500;

    ntrials = size(TFR_FFR.powspctrm,1);
    design  = zeros(2,2*ntrials);
    design(1,1:ntrials) = 1;
    design(1,ntrials+1:2*ntrials) = 2;
    design(2,1:ntrials) = [1:ntrials];
    design(2,ntrials+1:2*ntrials) = [1:ntrials];

    cfg.design   = design;
    cfg.ivar     = 1;
    cfg.uvar     = 2;

   TFR_FFR_stat =  ft_freqstatistics(cfg, TFR_FFR, TFR_FFRbaseline);


THE ERROR MESSAGE:
“Error using reshape
To RESHAPE the number of elements must not change.

Error in ft_statfun_actvsblT (line 115)
  timeavgdat=repmat(reshape(meanreshapeddat,(nchan*nfreq),nrepl),ntime,1);

Error in ft_statistics_montecarlo (line 267)
  [statobs, cfg] = statfun(cfg, dat, design);

Error in ft_freqstatistics (line 194)
    [stat, cfg] = statmethod(cfg, dat, design);

Error in TFRClusterBasedStats (line 54)
    TFR_FFR_stat =  ft_freqstatistics(cfg, TFR_FFR,
    TFR_FFRbaseline);”



Thank you,
David Prete
Ph.D. Candidate
McMaster Institute for Music and the Mind
Department Psychology, Neuroscience and Behaviour
McMaster University

<Screenshot (16).png>_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170906/ba4a2aa4/attachment-0001.html>


More information about the fieldtrip mailing list