[FieldTrip] ft_sourcegrandaverage

Wu, Jia jia.wu at yale.edu
Wed Sep 30 18:32:23 CEST 2015


Eelke,
It works. Thank you very much!
-jia
________________________________________
From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Eelke Spaak [eelke.spaak at donders.ru.nl]
Sent: Wednesday, September 30, 2015 11:04 AM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] ft_sourcegrandaverage

Hi Jia,

In principle: yes, that is what you should be doing. However, Matlab
provides some nice 'syntactic sugar' to achieve this much more easily
than typing it all in 'by hand'.

If you have collected your subjects in one big cell array [1]:

allsubj = {};
allsubj{1} = data_subj1;
allsubj{2} = data_subj2;
...

then you can use a (somewhat peculiar) Matlab syntax known as a
'comma-separated list' [2] (yes, the name of that syntax sounds pretty
intuitive, but intuitions are a bit deceiving here):

grandavg = ft_sourcegrandaverage(cfg, allsubj{:});

Hope that helps.

Best,
Eelke

[1] https://urldefense.proofpoint.com/v2/url?u=http-3A__uk.mathworks.com_help_matlab_cell-2Darrays.html&d=AwICAg&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=9ehCplyXHP0-m9ayYv1FOg&m=QGgii5kqByUq8awFQC0e7zYkGaJ5KyXZh3Ujg74IpK8&s=oO3lBSzSq6z62jjZXXa9C1toX4uvQQAXINKWwUKyVqM&e=
[2] https://urldefense.proofpoint.com/v2/url?u=http-3A__uk.mathworks.com_help_matlab_matlab-5Fprog_comma-2Dseparated-2Dlists.html&d=AwICAg&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=9ehCplyXHP0-m9ayYv1FOg&m=QGgii5kqByUq8awFQC0e7zYkGaJ5KyXZh3Ujg74IpK8&s=EMBuE99bxhWTpA8Rb1cQ4TUcgfskde3AGPrGmw1XXYo&e=

On 30 September 2015 at 15:54, Wu, Jia <jia.wu at yale.edu> wrote:
> Hi,
>
> If I have 100 subjects, do I have to do:
> grandavg = ft_sourcegrandaverage(cfg,s1,s2,s3,s4,s5,s6........s100)?
>
> Is there a better way? Or is it not what I should be doing?
>
> best,
> -jia
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl
https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.science.ru.nl_mailman_listinfo_fieldtrip&d=AwICAg&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=9ehCplyXHP0-m9ayYv1FOg&m=QGgii5kqByUq8awFQC0e7zYkGaJ5KyXZh3Ujg74IpK8&s=IqjJzNewlu4LDvzK-F6JHX9XuFSjTAJfSvx-KKHPTvA&e=




More information about the fieldtrip mailing list