[FieldTrip] Grand average with deleted channels

Erin White erin.white at sickkids.ca
Thu Apr 14 20:26:37 CEST 2016

Dear Eliana,
One option for you would be, rather than deleting the bad channels, to interpolate what their activity would be from the average of surrounding channels.
You can do this with FT_CHANNELREPAIR and it's pretty straightforward


Good luck with it!


Erin White, PhD
Post-Doctoral Research Fellow
Neurosciences and Mental Health
The Hospital for Sick Children
555 University Avenue
Toronto, Ontario
Telephone: (647)834-7813
From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Eliana Nicolaisen [elinicolaisen at gmail.com]
Sent: April 11, 2016 10:21 AM
To: fieldtrip at science.ru.nl
Subject: [FieldTrip] Grand average with deleted channels

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 complicated.

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 20150301?

Any comment would be greatly appreciated.

Kind regards,
Eliana Nicolaisen


This e-mail may contain confidential, personal and/or health information(information which may be subject to legal restrictions on use, retention and/or disclosure) for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160414/94865722/attachment-0002.html>

More information about the fieldtrip mailing list