[FieldTrip] Averaging on a random sample

Eelke Spaak eelke.spaak at donders.ru.nl
Fri Nov 21 10:29:10 CET 2014

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> 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!
> Emilie

More information about the fieldtrip mailing list