[FieldTrip] Averaging on a random sample

Caspar, Emilie e.caspar at ucl.ac.uk
Wed Nov 26 14:26:27 CET 2014

Thanks Eelke

If this can help someone else, here is the correct code:

arrondi=roundn(size(cleandata.trial,2)/2, 0);
        a = randperm(size(cleandata.trial,2));

        cfg = [];
        cfg.trials = r1;
        avgFCIndexHALF1 = ft_timelockanalysis(cfg, cleandata);

        cfg = [];
        cfg.trials = r2;
        avgFCIndexHALF2 = ft_timelockanalysis(cfg, cleandata);


Emilie Caspar

Aspirante FNRS - Ph.D. Student

Consciousness, Cognition & Computation Group (CO3)
Centre de Recherche Cognition et Neurosciences (CRCN)
ULB Neurosciences Institute (UNI)

Université Libre de Bruxelles
Av. F.-D. Roosevelt, 50
1050 Bruxelles

Voice : +32 2 650 32 95
mail : ecaspar at ulb.ac.be<mailto:ecaspar at ulb.ac.be>
office: DB10-138

Le 21 nov. 2014 à 10:29, Eelke Spaak <eelke.spaak at donders.ru.nl<mailto:eelke.spaak at donders.ru.nl>> a écrit :

Dear Emilie,

You are not providing a FT data structure to ft_timelockanalysis
(which you should), instead you are providing the raw cell array of
trials (which you shouldn't). Hence, FT complains that the data is not
in a structure that it can work with.

There is a cfg-option cfg.trials, which you might like to use instead.


On 21 November 2014 10:09, Caspar, Emilie <e.caspar at ucl.ac.uk<mailto:e.caspar at ucl.ac.uk>> wrote:
Dear Fieldtrippers,

I have a sample of 350 trials for one condition, but for statistical
analysis reasons I would like to split randomly this sample in two and
average these two parts.

so, I used the "randsample" matlab function which seems to work very well
and then I averaged this selected sample:

       randomhalf = randsample(cleandata.trial, 175);
       avgFCMiddleRing = ft_timelockanalysis(cfg, randomhalf);

However, I have the following error message :

Error using ft_checkdata (line 366)
This function requires raw or comp data as input.

Error in ft_timelockanalysis (line 105)
data = ft_checkdata(data, 'datatype', {'raw', 'comp'}, 'feedback', 'yes',
'hassampleinfo', 'yes');

Does anyone have a solution to fix the problem?

Thank you very much!


fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20141126/00b5dc44/attachment-0002.html>

More information about the fieldtrip mailing list