[FieldTrip] Averaging trials (ft_timelockanalysis)

Hamza Fawzi Altakroury (Student) hamzaf at sabanciuniv.edu
Sat May 5 11:15:40 CEST 2012


Hello again Stephen and for all,

I could not find out how to enter the following sturct into the
ft_timelockstatistics function

The input is generated using the following loop:

for i = 1:10
    cfg = [];
    cfg.trials = [(i-1)*10+1 : i*10];
    avgnonP300{i} = ft_timelockanalysis(cfg,nonp300);
end

and

for i = 1:10
    cfg = [];
    cfg.trials = [(i-1)*10+1 : i*10];
    avgP300{i} = ft_timelockanalysis(cfg,p300);
end


Then I use

cfg         = [];
cfg.layout  = 'CTF275.lay';
cfg.method  = 'crossvalidate';
cfg.design  = [ones(10,1); 2*ones(10,1)]';
stat = ft_timelockstatistics(cfg,avgP300,avgnonP300);

I get the following error

??? Error using ==> ft_checkdata at 307
This function requires timelock data as input.

Error in ==> ft_timelockstatistics at 75
  varargin{i} = ft_checkdata(varargin{i}, 'datatype', 'timelock',
'feedback',
  'no');

Error in ==> test05 at 11
stat = ft_timelockstatistics(cfg,avgP300,avgnonP300);


Any thoughts

Hamza


On Thu, May 3, 2012 at 12:28 PM, Hamza Fawzi Altakroury (Student) <
hamzaf at sabanciuniv.edu> wrote:

> Thanks a lot Stephen for your help,
>
> Hamza
>
>
>
> On Thu, May 3, 2012 at 12:20 PM, Stephen Whitmarsh <
> stephen.whitmarsh at gmail.com> wrote:
>
>> Dear Hamza,
>>
>> Actually, the statistic functions DO accept cellstructures of
>> datastructures, and what I suggested is therefor very convenient,
>> especially in that regard.
>> Please take a look at http://fieldtrip.fcdonders.nl/walkthrough. I
>> would recommend walking through it from the beginning, but you could
>> take a particular look at the statistics section. In there I try to
>> explain the data structure handling in detail which deals with your
>> question.
>>
>> Cheers,
>> Stephen
>>
>> On 3 May 2012 11:09, Hamza Fawzi Altakroury (Student)
>> <hamzaf at sabanciuniv.edu> wrote:
>> > Hello again,
>> >
>> > But I need to process my data later by ft_timelockstatistics.
>> > I don't think this funtion accepts cell containing many structs.
>> >
>> > I think its better to do average manually then call ft_lockanalysis,
>> then
>> > ft_timelockstatistics. Right?
>> >
>> > Hamza
>> >
>> >
>> > On Thu, May 3, 2012 at 11:36 AM, Stephen Whitmarsh
>> > <stephen.whitmarsh at gmail.com> wrote:
>> >>
>> >> Dear Hamza,
>> >>
>> >> Fieldtrip functions in generally do not work on several different
>> >> 'sets' of data at the same time.
>> >> Call the function you are using (e.g. ft_timelockanalysis) separately
>> >> for every set of trials and if you want put the output in a
>> >> matrix{1:10} of datastructures (e.g. timelock).
>> >> You can easily put it in a loop. Something like this:
>> >>
>> >> for i = 1:10
>> >>     cfg = [];
>> >>     cfg.trials = [(i-1)*10+1 : i*10];
>> >>     yourtimelockdata{i} = ft_function(cfg,yourdata)
>> >> end
>> >>
>> >> Hope this helps,
>> >> Stephen
>> >>
>> >>
>> >> On 3 May 2012 10:23, Hamza Fawzi Altakroury (Student)
>> >> <hamzaf at sabanciuniv.edu> wrote:
>> >> > Hello,
>> >> >
>> >> > I want to average each 10 trials of 100 trials.
>> >> > I don't know what to put in (cfg.trials)
>> >> >
>> >> > I tried cfg.trials = [1:10; 1:10]; and cfg.trials = [1:10; 11:20];
>> >> >
>> >> > It does not work?
>> >> >
>> >> > Note: at the end I want to have a cell of 10 matices, not just one
>> >> > matrix.
>> >> >
>> >> > Any thoughts?
>> >> >
>> >> > Best,
>> >> >
>> >> > --
>> >> > Hamza Fawzi Altakroury
>> >> > Graduate student - MA
>> >> > Faculty of Engineering and Natural Sciences
>> >> > Sabancı University
>> >> >
>> >> > _______________________________________________
>> >> > fieldtrip mailing list
>> >> > fieldtrip at donders.ru.nl
>> >> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> >>
>> >> _______________________________________________
>> >> fieldtrip mailing list
>> >> fieldtrip at donders.ru.nl
>> >> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> >
>> >
>> >
>> >
>> > --
>> > Hamza Fawzi Altakroury
>> > Graduate student - MA
>> > Faculty of Engineering and Natural Sciences
>> > Sabancı University
>> >
>> > _______________________________________________
>> > fieldtrip mailing list
>> > fieldtrip at donders.ru.nl
>> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
>
>
> --
> Hamza Fawzi Altakroury
> Graduate student - MA
> Faculty of Engineering and Natural Sciences
> Sabancı University
>



-- 
Hamza Fawzi Altakroury
Graduate student - MA
Faculty of Engineering and Natural Sciences
Sabancı University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120505/b11e75d0/attachment-0002.html>


More information about the fieldtrip mailing list