[FieldTrip] Only 1 and Inf as output of ft_connectivityanalysis

Lucia Melloni lmelloni at gmail.com
Mon Apr 29 02:38:57 CEST 2013

I am trying to calculate coherence using ft_connectivityanalysis, but
I am getting only ones and infinity as output in cohspctrm with all of
my data sets.

I first run ft_freqanalysis with
cfg.method = 'mtmfft';
cfg.taper = 'dpss';
cfg.output = 'fourier';
cfg.foilim = [1 45];
cfg.tapsmofrq = 1;
cfg.keeptrials = 'yes';
cfg.keeptapers = 'yes';
freq = ft_freqanalysis(cfg, data);

Whether I do or I do not specify cfg.channel and cfg.channelcmb here
does not seem to make a difference for my problem later on. The
spectra look absolutely fine.

I then run ft_connectivityanalysis with
cfg.method    = 'coh';
cfg.removemean= 'yes';
cfg.trials    = 'all';
cfg.feedback  = 'yes';
cfg.complex   = 'abs';
coh           = ft_connectivityanalysis(cfg, freq);

The cohspctrm looks like this:
val(:,:,1,1) =

     1   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf
Inf   Inf   Inf (etc.)

I get the following warning during ft_connectivityanalysis

Warning: Divide by zero.
> In ft_connectivity_corr at 103
  In ft_connectivityanalysis at 524
Warning: Divide by zero.
> In ft_connectivity_corr at 104
  In ft_connectivityanalysis at 524

The same happens if I try to calculate PLV through ft_connectivityanalysis.
This is with Fieldtrip version 20130422 and 20130427, Matlab R2009a,
Windows 7 (64bit).

Any advice?

More information about the fieldtrip mailing list