[FieldTrip] only NaNs in ft_freqgrandaverage output

Gina Brazof gina.brazof at gmail.com
Sun Apr 26 21:41:27 CEST 2020


Dear Community,

I preprocessed my EEG data in EEGlab and now I would like to run a time
frequency analysis using FielTrip. I start by saying that I am new with the
time frequency analysis, matlab and fieldtrip, so I say sorry in advance
for my ignorance.
For each of my experiment conditions (experimental design 2*2
within-subjects), I tried to run a wavelet tranformation and a grandavarage
across all subjects. However, the values of the gandAverage powspctrm in
two out of four conditions are only NaNs and I can not figure out why that
is happening. Indeed, the code has been structurally the same for all
conditions. In addition, the object of the ft_ freqgrandaverage in these
two problematic conditions do not contain the reasonable amount of NaNs to
justify the values in the gandaverage. Could someone help me to undertand
where the problem could be?
Below the example of code I used for each condition:

%%%%% oggPain COONDITION 1

TFreqAv_oggPain = cell(1,nSubjs);
for i = 1:nSubjs

    subs     = subjects{i};
    fileName = '_data.mat';
    dataSet  = strcat('C:\Users\bia\Desktop\dati carlotta\', subs, fileName
);
    %dataSet = fullfile(dataPath,subjects{i},fileName);
    load(dataSet); % loading the variable 'data'

    %%%%%%%%% Computing time-frequency representation for each trial
    cfg = [];
    cfg.method = 'wavelet';
    cfg.foi    = 4:1:30;
    cfg.toi    = -0.8:0.01:1.5;
    cfg.width  = 7;
   %cfg.keeptrials = 'yes';
    cfg.channel    = 'all';
    cfg.trials     = find(celltomat(data.trialinfo(:,1)) == 7 | celltomat
(data.trialinfo(:,1)) == 8 | celltomat(data.trialinfo(:,1)) == 11 |
celltomat(data.trialinfo(:,1)) == 12);  %numbers differ according to exp.
condition
    cfg.outputfile = strcat('C:\Users\bia\Desktop\dati carlotta\',
subs,'_oggPain');
    TFreqAv_oggPain{i}= ft_freqanalysis(cfg,data);
    clear data
end
save TFreqAv_oggPain.mat TFreqAv_oggPain

bslnTFreqAv_oggPain = cell(1,nSubjs);
for i = 1:nSubjs

    subs     = subjects{i};
    fileName = '_oggPain.mat';
    dataSet  = strcat('C:\Users\bia\Desktop\dati carlotta\', subs, fileName
);
    load(dataSet); % loading the variable 'freq'

    %%%%%%%%% Computing the change relative to a baseline
    cfg = [];
    cfg.baselinetype = 'relchange';
    cfg.baseline     = [-0.05 -0.02];
    bslnTFreqAv_oggPain{i} = ft_freqbaseline(cfg,freq);
    clear freq
end
save bslnTFreqAv_oggPain.mat bslnTFreqAv_oggPain

%% Grand average time-frequency data
cfg = [];
gAvgTFreq_oggPain     = ft_freqgrandaverage(cfg,TFreqAv_oggPain{:});
save gAvgTFreq_oggPain.mat gAvgTFreq_oggPain
gAvgBslnTFreq_oggPain = ft_freqgrandaverage(cfg,bslnTFreqAv_oggPain{:});
save gAvgBslnTFreq_oggPain.mat gAvgBslnTFreq_oggPain

Thank for any kind of tips,

Gina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200426/d82656b5/attachment.htm>


More information about the fieldtrip mailing list