[FieldTrip] Grand Average on time lock data

Caspar, Emilie e.caspar at ucl.ac.uk
Mon Sep 1 09:02:16 CEST 2014


Dear all,

I would like to perform the grand average in a separate script than the preprocessing one, to avoid a crash, because of the number of participants. In the preprocessing script, I performed a timelockanalysis for each participants : avgFC = ft_timelockanalysis(cfg, cleandata);
and then save this file :
finfname  = [subjID{s} '_RP'];
mkdir(subjID{s})
save([subjPath filesep finfname '.mat'], 'avgFC');


So, in my grand average script, I wrote the following :

cfg = [];
homePath    = '/Users/emilie/Desktop/EEG_RP/Grandaverage/';
eegPath = homePath;



%% Subjects
datafiles      = {'S83_RP','S84_RP','S85_RP','S87_RP','S88_RP','S89_RP','S90_RP','S91_RP','S92_RP','S93_RP','S94_RP','S97_RP','S98_RP','S99_RP','S100_RP', 'S101_RP'};
nFiles      = length(datafiles);
avgs = cell(1,nFiles);



cfg.channel   = 'all';
cfg.latency   = 'all';
%cfg.parameter = 'avg';



for iFile = 1:nFiles
    thisfile = datafiles{iFile};
    subjPath = [eegPath  thisfile];
    file = dir([subjPath  '*.mat']);
    avgs{iFile} = ft_checkdata(avgs{iFile}, 'datatype', 'timelock', 'feedback', 'no');
    avgs{iFile} = load(datafiles{iFile});
end



GA = ft_timelockgrandaverage(cfg, avgs{:});

But I'm not pretty sure to understand the error message :
Error using ft_checkdata (line 366)
This function requires timelock data as input.

Error in Averaging (line 33)
    avgs{iFile} = ft_checkdata(avgs{iFile}, 'datatype', 'timelock', 'feedback', 'no');

Because If I'm right, the files in 'datafiles' are the time locked data from the preprocessing script.

Thank you,

Emilie

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140901/9bbda080/attachment-0001.html>


More information about the fieldtrip mailing list