[FieldTrip] Grand average with deleted channels

Eliana Nicolaisen elinicolaisen at gmail.com
Mon Apr 11 16:21:52 CEST 2016

Dear all,

I'm trying to make an ERP grand average using version 20150301. In some
subjects I deleted bad channels. Those channels were replaced for NaNs.
When I make the grand average using ft_timelockaverage, the grand average
is composed only for the common channels across subjects. In other words,
in channels deleated at least in one subject the grand average is NaN. This
is because ft_timelockanalysis in this version calculates the average
making a sum and dividng into degrees of freedom:

*grandavg.avg   = reshape(sum(avgmat, 1), datsiz)./ResultDOF; *

(in line 187 of revision '$Id: ft_timelockgrandaverage.m 10194 2015-02-11
09:08:16Z roboos $')

However, I tried version 20121014 that my colleague uses. In this version
ft_timelockedanalysis makes a mean:

*ResultGrandavg = mean(avgmat, 1);*

(in line 183 of revision '$Id: ft_timelockgrandaverage.m 6750 2012-10-13
15:07:32Z roboos $')

In the version 20121014 is easy to make a correction that calculates a
grand average taking into account NaNs (just changing mean for nanmean).
However, in version 20150301 making a similar correction seems more

Question 1: Why version 20150301 calculates average using sum and division
instead of using nanmean?
Question 2: Do someone have a suggestion about how to change version

Any comment would be greatly appreciated.

Kind regards,
Eliana Nicolaisen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160411/976923c1/attachment-0001.html>

More information about the fieldtrip mailing list