[FieldTrip] ft_freqstatistics issue (??? Undefined function or method 'randperm' for input arguments of type 'double'.)

Roemer van der Meij r.vandermeij at donders.ru.nl
Tue Sep 13 11:00:13 CEST 2011


Hi Davide,

It sounds like you are missing the Statistics Toolbo 
<http://www.mathworks.nl/products/statistics/index.html>x for matlab. I 
remember some internal discussions in the team about writing an internal 
version of randperm.m with similar functions, but we haven't done so far 
if I recall correctly. Installing the toolbox, or checking whether you 
have it on your path should solve your problem.

Hope it helps,
Roemer



On 13-09-11 9:38, Davide Rivolta wrote:
> Dear fieldtrippers,
> I wish to calculate the stat difference between stimulus and baseline 
> in a group of subjects. I use ft_freqgrandaverage to average across 
> subjects and then ft_freqstatistics (cluster statistic) to compare the 
> 2 conditions (baseline & stimuli).
> I get this error:    ??? Undefined function or method 'randperm' for 
> input arguments of type 'double'.
> I tried even with the newest version (20110911) but the problem 
> persists. I am not sure what I have to do.
> Any advice would be super. The script is below.
> Thanks a lot,
> Davide
> datainpath = '/data/home1/drivolta/Out4VG/DATA/';
> dataoutpath = '/data/home1/drivolta/Out4VG/DATA/';
>
> % Controls
> Controls = {
>     'ASS31_TFR_high.mat';
>     'CSA07_TFR_high.mat';
>     'BMR08_TFR_high.mat';
>     'NPD18_TFR_high.mat';
>     %'BSA08_TFR_high.mat';
>     %'ABE08_TFR_high.mat';
>     %'EES05_TFR_high.mat';
>     %'GPS10_TFR_high.mat';
>     %'SDA01_TFR_high.mat';
>     %'CSA17_TFR_high.mat';
>     %'KBZ16_TFR_high.mat';
>
> };
> %--------------------------------------------------------------------------
> NControls = length(Controls);
> %% CONCATENATE DATA
> for i = 1:length(Controls)
>     fullname = strcat(datainpath, Controls{i,1});
>     load(fullname);
>
>     % Activation time window
>     TFR2 = power_continue_high; %Rename to change (select time window)
>     idx = find((TFR2.time >= 0.5) &(TFR2.time <= 1.5));
>     TFR2.powspctrm = power_continue_high.powspctrm(:, :,idx);
>     TFR2.time = power_continue_high.time(idx);
>     Stimuli{i} = TFR2;
>
>     % Baseline time window
>     TFR3 = power_continue_high;
>     idx = find((TFR3.time >= -1) &(TFR3.time < 0));
>     TFR3.powspctrm = power_continue_high.powspctrm(:,:, idx);
>     TFR3.time = TFR2.time;
>     Baseline{i} = TFR3;
>
>     clear power_continue_high
>     clear TFR2
>     clear TFR3
> end;
> save Controls2Statistics Stimuli Baseline;
>
> cfg = [];
> cfg.channel = {'MEG', '-MRO31', '-MRO21'};
> cfg.keepindividual = 'yes';
> BaselineAll = ft_freqgrandaverage(cfg, Baseline{:});
> StimuliAll = ft_freqgrandaverage(cfg, Stimuli{:});
> load /data/home1/drivolta/Out4VG/DATA/GRAD % File with a structure 
> containing grad field
> cfg                = [];
> cfg.method         = 'triangulation';
> cfg.neighbourdist  = 5;
> cfg.grad           = TFR.grad;
> cfg.layout         = 'CTF275.lay';
> neighbour          = ft_neighbourselection(cfg, Baseline{1});
> cfg = [];
> cfg.grad             = TFR.grad;
> cfg.channel          = {'MEG', '-MRO31', '-MRO21'};
> cfg.neighbourdist    = 4;
> cfg.minnbchan        = 1;
> cfg.clusteralpha     = 0.05; % control admission to a cluster
> cfg.alpha            = 0.05; % control the false alarm rate of the 
> permutation test
> cfg.latency          = [0.5 1.5]; % time interval over which the 
> experimental conditions are compared (in sec)
> cfg.frequency        = [50 70];
> cfg.avgovertime      = 'no';
> cfg.avgoverfreq      = 'no';
> cfg.avgoverchan      = 'no';
> cfg.clusterstatistics = 'maxsum';
> cfg.statistic        = 'actvsblT';
> cfg.numrandomization = 1000;
> cfg.correctm         = 'cluster';
> cfg.method           = 'montecarlo';
> cfg.approach         = 'montecarlo';
> cfg.dimord           = 'chan_freq_time';
> cfg.dim              = 'chan_freq_time';
> cfg.neighbours       = neighbour;
> cfg.tail = 0;
> cfg.clustertail = 0;
> nSubjects = 2*length(Controls);
> a = [1:nSubjects];
> b = ones(1,length(Controls));
> c = 2*(ones(1,length(Controls)));
> cfg.design = [a; b c];
> cfg.uvar = 1; % "subject" is unit of observation
> cfg.ivar = 2; % row of the design matrix that contains the independent 
> variable
> stat = ft_freqstatistics(cfg, BaselineAll, StimuliAll);
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-- 
Roemer van der Meij M.Sc.
PhD student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognition
P.O. Box 9104
6500 HE Nijmegen
The Netherlands
Tel: +31(0)24 3655932
E-mail: r.vandermeij at donders.ru.nl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20110913/b90d5fc8/attachment-0002.html>


More information about the fieldtrip mailing list