[FieldTrip] Reshape Error Using ft_freqstatistics

David preted at mcmaster.ca
Wed Sep 6 16:48:26 CEST 2017


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 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170906/51fd4f8e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot (16).png
Type: image/png
Size: 161547 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170906/51fd4f8e/attachment-0001.png>


More information about the fieldtrip mailing list