<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Davide,<br>
    <br>
    It sounds like you are missing the <a
      href="http://www.mathworks.nl/products/statistics/index.html">Statistics
      Toolbo</a>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. <br>
    <br>
    Hope it helps,<br>
    Roemer<br>
    <br>
    <br>
    <br>
    On 13-09-11 9:38, Davide Rivolta wrote:
    <blockquote
cite="mid:CAMkcSw7VcTOp6rHZhFCyWxWFTwZ6BJTbNH5wgbuhTDh6W9Mbkg@mail.gmail.com"
      type="cite">
      <div>Dear fieldtrippers,</div>
      <div> </div>
      <div>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).</div>
      <div> </div>
      <div>I get this error:    ??? Undefined function or method
        'randperm' for input arguments of type 'double'.</div>
      <div> </div>
      <div>I tried even with the newest version (20110911) but the
        problem persists. I am not sure what I have to do.</div>
      <div> </div>
      <div>Any advice would be super. The script is below.</div>
      <div> </div>
      <div>Thanks a lot,</div>
      <div> </div>
      <div>Davide</div>
      <div> </div>
      <div> </div>
      <div> </div>
      <div>datainpath = '/data/home1/drivolta/Out4VG/DATA/';<br>
        dataoutpath = '/data/home1/drivolta/Out4VG/DATA/';</div>
      <div><br>
        % Controls<br>
        Controls = { <br>
            'ASS31_TFR_high.mat';<br>
            'CSA07_TFR_high.mat';<br>
            'BMR08_TFR_high.mat'; <br>
            'NPD18_TFR_high.mat';<br>
            %'BSA08_TFR_high.mat'; <br>
            %'ABE08_TFR_high.mat';<br>
            %'EES05_TFR_high.mat';<br>
            %'GPS10_TFR_high.mat'; <br>
            %'SDA01_TFR_high.mat';<br>
            %'CSA17_TFR_high.mat';<br>
            %'KBZ16_TFR_high.mat';<br>
            <br>
        };</div>
      <div> </div>
      <div>%--------------------------------------------------------------------------</div>
      <div>NControls = length(Controls);</div>
      <div> </div>
      <div>%% CONCATENATE DATA</div>
      <div>for i = 1:length(Controls)<br>
            fullname = strcat(datainpath, Controls{i,1});<br>
            load(fullname); <br>
           <br>
            % Activation time window<br>
            TFR2 = power_continue_high; %Rename to change (select time
        window)<br>
            idx = find((TFR2.time >= 0.5) &(TFR2.time <=
        1.5));<br>
            TFR2.powspctrm = power_continue_high.powspctrm(:, :,idx);<br>
            TFR2.time = power_continue_high.time(idx);<br>
            Stimuli{i} = TFR2;<br>
            <br>
            % Baseline time window<br>
            TFR3 = power_continue_high;<br>
            idx = find((TFR3.time >= -1) &(TFR3.time < 0));<br>
            TFR3.powspctrm = power_continue_high.powspctrm(:,:, idx);<br>
            TFR3.time = TFR2.time;<br>
            Baseline{i} = TFR3;<br>
            <br>
            clear power_continue_high<br>
            clear TFR2<br>
            clear TFR3<br>
        end;<br>
      </div>
      <div>save Controls2Statistics Stimuli Baseline;</div>
      <div> </div>
      <div> </div>
      <div><br>
        cfg = [];<br>
        cfg.channel = {'MEG', '-MRO31', '-MRO21'}; <br>
        cfg.keepindividual = 'yes';</div>
      <div> </div>
      <div>BaselineAll = ft_freqgrandaverage(cfg, Baseline{:});<br>
        StimuliAll = ft_freqgrandaverage(cfg, Stimuli{:});</div>
      <div> </div>
      <div> </div>
      <div> </div>
      <div>load /data/home1/drivolta/Out4VG/DATA/GRAD % File with a
        structure containing grad field</div>
      <div> </div>
      <div>cfg                = [];<br>
        cfg.method         = 'triangulation';<br>
        cfg.neighbourdist  = 5;<br>
        cfg.grad           = TFR.grad;<br>
        cfg.layout         = 'CTF275.lay';<br>
        neighbour          = ft_neighbourselection(cfg, Baseline{1});<br>
      </div>
      <div>cfg = [];<br>
        cfg.grad             = TFR.grad; <br>
        cfg.channel          = {'MEG', '-MRO31', '-MRO21'}; <br>
        cfg.neighbourdist    = 4; </div>
      <div>cfg.minnbchan        = 1; </div>
      <div>cfg.clusteralpha     = 0.05; % control admission to a cluster<br>
        cfg.alpha            = 0.05; % control the false alarm rate of
        the permutation test<br>
        cfg.latency          = [0.5 1.5]; % time interval over which the
        experimental conditions are compared (in sec)<br>
        cfg.frequency        = [50 70];<br>
        cfg.avgovertime      = 'no';<br>
        cfg.avgoverfreq      = 'no';<br>
        cfg.avgoverchan      = 'no';<br>
        cfg.clusterstatistics = 'maxsum';<br>
        cfg.statistic        = 'actvsblT';<br>
        cfg.numrandomization = 1000; </div>
      <div>cfg.correctm         = 'cluster';<br>
        cfg.method           = 'montecarlo';<br>
        cfg.approach         = 'montecarlo';<br>
        cfg.dimord           = 'chan_freq_time';<br>
        cfg.dim              = 'chan_freq_time';<br>
        cfg.neighbours       = neighbour;<br>
        cfg.tail = 0;<br>
        cfg.clustertail = 0;</div>
      <div> </div>
      <div>nSubjects = 2*length(Controls);</div>
      <div> </div>
      <div>a = [1:nSubjects];<br>
        b = ones(1,length(Controls));<br>
        c = 2*(ones(1,length(Controls)));</div>
      <div> </div>
      <div>cfg.design = [a; b c];<br>
        cfg.uvar = 1; % "subject" is unit of observation<br>
        cfg.ivar = 2; % row of the design matrix that contains the
        independent variable</div>
      <div> </div>
      <div>stat = ft_freqstatistics(cfg, BaselineAll, StimuliAll);</div>
      <div> </div>
      <div> </div>
      <div> </div>
      <div> </div>
      <div> </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
fieldtrip mailing list
<a class="moz-txt-link-abbreviated" href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>
<a class="moz-txt-link-freetext" href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></pre>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      <font size="2"><font color="darkblue"><font face="calibri">Roemer
            van der Meij M.Sc.<br>
            PhD student<br>
            Donders Institute for Brain, Cognition and Behaviour<br>
            Centre for Cognition<br>
            P.O. Box 9104<br>
            6500 HE Nijmegen<br>
            The Netherlands<br>
            Tel: +31(0)24 3655932<br>
            E-mail: <a class="moz-txt-link-abbreviated" href="mailto:r.vandermeij@donders.ru.nl">r.vandermeij@donders.ru.nl</a><br>
          </font></font></font></div>
  </body>
</html>