[FieldTrip] Issues with TF analysis and plotting

Tom Marshall tom.marshall at psy.ox.ac.uk
Fri Aug 3 12:30:37 CEST 2018

Hi Poppy,

You've asked not to keep the trials (cfg.keeptrials = 'no'), but then propagated that cfg to your call to ft_singleplotTFR. So fieldtrip is reading the cfg.trials field again at plotting and is trying to find the trials again in 'freqdata'. But there aren't any trials there anymore.

If you change cfg.keeptrials = 'yes' in your call to ft_freqanalysis this code will work. Alternatively add a cfg = [] before the call to ft_singleplotTFR.

From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Poppy Watson <popwatson at hotmail.com>
Sent: 03 August 2018 06:23:00
To: fieldtrip at science.ru.nl
Subject: [FieldTrip] Issues with TF analysis and plotting

Dear all,

Sorry for this simple question but I am unable to work out what I am doing wrong.

I am working through a TF analysis using all the online tutorials etc. I’m interested in the time window 1 second before the trigger but have taken a 2 second window (0.5 seconds either side of the bit I am interested in). Everything seems to be going ok and the freq.powspctrm object seems to be the correct size but when plotting my results (using any of the multiplot, singeplot or topoplot methods) I keep getting the error message: incorrect specification of cfg.trials for data without repetitions.

See here some example code:

  cfg.trials  = highValSuccessTrials; % this is a vector of trial numbers

  cfg.method = 'mtmconvol';

  cfg.keeptrials = 'no';

  cfg.output = 'pow';

  cfg.channel = 'eeg';

  cfg.taper = 'hanning';

  cfg.foi   = 2:2:30;

  cfg.t_ftimwin    = ones(length(cfg.foi),1).*2;   % length of time window = 2 sec

  cfg.toi          = -1.5:0.05:0.5;                  % time window "slides" from -1.5 to 0.5 sec (0.5 s after stim presentation) in steps of 0.05 sec (50 ms)

  freqdata = ft_freqanalysis(cfg, preProcData);


cfg.baseline     = [-1.5 -1.1]; % this is just before my 1 sec of interest

cfg.baselinetype = 'absolute';

cfg.maskstyle    = 'saturation';

cfg.channel      = 'FcZ';


ft_singleplotTFR(cfg, freqdata);

Much appreciated!

P. Watson

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

More information about the fieldtrip mailing list