[FieldTrip] type mismatch error in ft_freqanalysis

Ozan Çağlayan ozancag at gmail.com
Tue Dec 10 17:40:49 CET 2013


Hi,

I was struggling with the problem below for an hour and digging
through the code I found out that I was setting cfg.fsample = 128
instead of cfg.fsample = 128.0 which was causing an int32 cfg.pad
which was causing a type mismatch in the below line.

I think either in the docs it should be told that the fsample needs to
be a double or FT should cast it to double transparently.

Or can this be caused by Matlab 2013a as told by the warnings :)

>> [freqs] = ft_freqanalysis(cfg, data)
Warning: You are using MATLAB 2013a. FieldTrip is currently not
supported on 2013a (8.1) or newer. Using your current
MATLAB version can lead to unexpected behaviour, which might not be
easily noticable. Continuing is not advised.
> In ft_defaults at 64
  In ft_freqanalysis at 191
the input is raw data with 14 channels and 1 trials
Error using  .*
Integers can only be combined with integers of the same class, or
scalar doubles.

Error in ft_freqanalysis (line 423)
  fboi   = round(cfg.foi .* cfg.pad) + 1;

*********

Here cfg.pad is an int32 with 10 in it and cfg.foi = [].

>> [] .* double(10)

ans =

     []

>> [] .* int32(10)
Error using  .*
Integers can only be combined with integers of the same class, or
scalar doubles.

and pad is set as:

  padding = max(trllength);
  cfg.pad = padding/data.fsample; // trllength == 1280, fsample == 128
in my case.

-- 
Ozan Çağlayan
Research Assistant
Galatasaray University - Computer Engineering Dept.
http://www.ozancaglayan.com




More information about the fieldtrip mailing list