[FieldTrip] Bug in ft_freqcomparison.m?

Arjen Stolk a.stolk8 at gmail.com
Wed Apr 10 11:36:48 CEST 2013

Hi Alex,

Thanks for looking into this function.  You’re right that ft_freqcomparison
initializes the output structure ‘ freq’ (line 87) using the first input
structure. This could indeed be problematic when the two input structures
are dissimilarly sized.  In fact, having a size difference in the powspctrm
fields between the two input structure is an exclusion criterion for using
this function in the first place, e.g. because it may result in comparing
frequency powers of different channels, trials, or subjects. For that
reason, a check was built in at lines 92 and 115, which ensures that the
input structures have identical matrix size. Although not intuitive clear
maybe from a reader’s perspective, this is thus not an issue and it will
not affect your data.

Also please note that ft_freqcomparison has become outdated with the
arrival of ft_math. Technically, this function can do the same, but with
more flexibility and better bookkeeping.

Best wishes,


2013/3/13 Alexander Maye <a.maye at uke.de>

> Hi All,
> I just spotted something that could be a bug in ft_freqcomparison.m
> (fieldtrip-20130312 and previous versions). Don't now if this is the place
> for
> report, but if this really is an issue everyone using this function may be
> interested.
> The problem is in line 87 where freq = varargin{1}; is initialized to the
> *first* freq argument, that according to the doc is used as the norm. So
> the
> output (powspctrm) has the dimension of the norm, not the second freq
> argument, that one wants to become normalized. Strange, hmm? Then, in the
> following for-loops the index variable runs over the size of the *second*
> freq
> argument, updating trials in the powspctrm with the size of the *first*
> freq
> argument, which seems simply wrong.
> Maybe this is an ingenious programming trick, but initializing freq =
> varargin{2}; on line 87 would make more sense from my point of view.
> Best,
>                                  ALEX.
> --
> Pflichtangaben gemäß Gesetz über elektronische Handelsregister und
> Genossenschaftsregister sowie das Unternehmensregister (EHUG):
> Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen
> Rechts; Gerichtsstand: Hamburg
> Vorstandsmitglieder: Prof. Dr. Martin Zeitz (Vorsitzender), Dr. Alexander
> Kirstein, Joachim Prölß, Prof. Dr. Dr. Uwe Koch-Gromus
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130410/2ed824c4/attachment-0001.html>

More information about the fieldtrip mailing list