<html><head><style> body {height: 100%; color:#000000; font-size:12pt; font-family:Arial;}</style></head><body>Hi,<br><br>I'm trying to run cluster statistics on coherence between a single channel (actually 2) and a set of 516 channels. My code crashes when ft_freqstatistics reaches clusterstat [Error using ==> reshape; To RESHAPE the number of elements must not change.<br>Error in ==> clusterstat at 182; posclusobs = findcluster(reshape(postailobs, [cfg.dim,1]),channeighbstructmat,cfg.minnbchan); ]<br>At this point postailobs is much larger than multiplying the elements of cfg.dim.<br>But digging into it the problem starts earlier, and as far as I can see is a result of incompatibility between the output of freqanalysis and the way indepsamplesZcoh treats the data:<br>In freqanalysis I calculate csd between each of the two channels and all the rest, i.e. I have 2 * (516+1) = 1034 pairs. The dimension of the resulting freq.crssspctrm is 10 (trials) x 1034 (channel pairs) x 51 (frequencies) x 1 (times). <br>In indepsamplesZcoh using the freqanalysis output, for each frequency I have a 1034x10 matrix multiplied by its transpose to get a dimension of 1034x1034. This is of-course much higher than the dimension of the data which should be something like 517x2. <br><br>How should I transform the freqanalysis output so that it'll be used correctly by indepsamplesZcoh?<br><br>Thanks!<br>Dahlia.<br><br>PS - here is part of the code that might be helpful, please let me know if any further information would help.<br><br>+++++++++++++++++++++++++++++++++++++++++++++++++++++<br>% configuration for freqanalysis<br>cfgfa = [];<br>cfgfa.output = 'powandcsd'; % 'pow';<br>cfgfa.toi = -.25:.025:1.25; <br>cfgfa.foi = 6:2:80; %%<br>cfgfa.method = 'mtmfft'; % 'mtmconvol';<br> cfgfa.trials = 'all'; <br>cfgfa.keeptrials = 'yes';<br>cfgfa.channel = {'all' };<br>cfgfa.channelcmb = { 'rh-Jz MT' 'all' ; 'lh-Jz MT' 'all' }; % compute csd between right MT and all<br><br>% configuration for freqstatistics <br>cfgfs = [];<br>cfgfs.numrandomization = 100;<br>cfgfs.method = 'montecarlo';<br>cfgfs.correctm = 'cluster';<br>cfgfs.clusteralpha = 0.05; % significance level for sample-level statistic, i.e. for being considered candidate for clustering<br>cfgfs.clusterstatistic = 'maxsum'; % maxsize<br>cfgfs.clusterthreshold = 'parametric'; % uses T distribution to calculate the sample-level statistic threshold - appropriate for cfg.statistic=indepsamplesT<br>cfgfs.minnbchan = 0; %<br>cfgfs.alpha = 0.05; % significance level for cluster-level statistic, i.e. for final result of significant cluster.<br>cfgfs.tail = 0; % 0 for two-sided testing<br>cfgfs.correcttail = 'alpha'; <br>cfgfs.ivar = 1;<br>cfgfs.latency = 'all';<br>cfgfs.frequency = 'all';<br>cfgfs.neighbours = [];<br><br>cfgfs_coh = cfgfs;<br>cfgfs_coh.statistic = 'indepsamplesZcoh';<br>cfgfs_coh.label = { 'all' }; %{ 'rh-Jz MT' 'all' ; 'lh-Jz MT' 'all' };<br><br> for trig = 100:100:200<br> trigstr = num2str( trig); disp([subj ' trig' trigstr])<br> invtrigfile = strcat( invtrigfile_base{1} , trigstr , invtrigfile_base{2});<br> load(invtrigfile)<br> <br> freq = ft_freqanalysis( cfgfa, data_ftrip);<br> ntrl = size( freq.powspctrm, 1 ); eval(['ntrl' trigstr '=ntrl;'])<br> end<br> design = ones(1, ntrl100 + ntrl200); design(ntrl200+1:end)=2;<br> ccfgfs_coh.design = design;<br>% cfgfs_coh.label = freq.labelcmb;<br> cfgfs_coh.channelcmb = freq.labelcmb;<br> coh_stat = ft_freqstatistics( cfgfs_coh, freq200, freq100);</body></html>
<p>----------------------------------</p>
<p>The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis.</p>
<p> http://listserv.surfnet.nl/archives/fieldtrip.html</p>
<p> http://www.ru.nl/fcdonders/fieldtrip/</p>