timelockstatistics for single-subjects

Erick Britis Ortiz Erick.Ortiz at MED.UNI-TUEBINGEN.DE
Fri Nov 21 15:23:11 CET 2008

Hello all,

I have a small problem in calculating statistics comparing two
conditions for one subject. When I have a grand average (created with
keepindividual), everything works nicely, but for one subject (with avg
created with keeptrials), I have to remove the field 'dof' from the avg
structure. The reason for that is that 'dof' has the dimensions of
channel x sample, and on line 673 of prepare_timefreq_data.m I get an
error for trying to reshape it in trials x sample.

Has anyone found it before or am I doing something wrong? The following
example code was supposed to work:

cfg = [];
cfg.keeptrials = 'yes';
avg1 = timelockanalysis(cfg, data1);
avg2 = timelockanalysis(cfg, data2);

cfg = [];
cfg.channel     = 'MEG';
cfg.method      = 'analytic';
cfg.statistic   = 'indepsamplesT';
cfg.alpha       = 0.05;
cfg.correctm    = 'no';
Ntrl1 = size(avg1.trial,1);
Ntrl2 = size(avg2.trial,1);
cfg.design(1,1:(Ntrl1+Ntrl2))  = [ones(1,Ntrl1) 2*ones(1,Ntrl2)];
cfg.ivar  = 1;
stat = timelockstatistics(cfg,avg1,avg2)

But only works when I use instead:

stat = timelockstatistics(cfg,rmfield(avg1,'dof'),rmfield(avg2,'dof'))

Any light on this?


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. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.

More information about the fieldtrip mailing list