[FieldTrip] grand average (with average across frequencies)

Xie Wanze xiew1202 at gmail.com
Wed Jul 13 04:22:30 CEST 2016

 It is not difficult to do grand average across subjects or frequencies if
I understand your questions correctly.
 After you get the powspctrm matrix (chan x freq) for each subject, you can
write a "for loop" to read in each person's data and then divided by the
total number of subjects. Assuming you name your output structure as
EEG_freq for each subject, the syntax would be something like:
  freqtotal = []; numsubject = 0;
  for i = 1:length(subjects)
     ...load your data here;
        if ~numsubject; freqtotal = EEG_freq.powspctrm;
        else; freqtotal = freqtotal + EEG_freq.powspctrm;
        numsubject = numsubject + 1;
 freqavg = freqtotal / numsubject;  or freqavg = freqtotal /

 To get average across frequencies, simply use the "mean" function. If you
have the chan x pow structure for your output then use "mean (freqavg, 2)"
will do the average across the second dimension (i.e., frequencies).
 Or you can do the average for frequencies for each subject then do the
average across subjects.

 Hope this will answer your questions.


2016-07-12 13:45 GMT-04:00 Jose <joseluisblues at gmail.com>:

> dear list,
> I'm analysing CTF MEG data. I computed the power of my data for
> frequencies from 1 to 50 Hz. Is it possible to perform a grand average
> across my subjects, but additionally averaging across frequencies for
> exploratory purposes? Maybe there is a way to do it with
> ft_freqgrandaverage?, but so far I haven't find it,
> Many thanks for any hint,
> Jose
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160712/fda69ccd/attachment-0002.html>

More information about the fieldtrip mailing list