[FieldTrip] ft_sourcegrandaverage

Wu, Jia jia.wu at yale.edu
Fri Oct 2 15:10:44 CEST 2015


Hi Stephen (and hi Raquel)
Eelke in an previous email suggested the same thing and it worked really well. Thanks everyone for help.
best,
-jia
________________________________
From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Stephen Whitmarsh [stephen.whitmarsh at ki.se]
Sent: Friday, October 02, 2015 4:32 AM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] ft_sourcegrandaverage

Hi Jia, (and hi Raquel!)

Perhaps easiest is if you get all your subjects in a MATLAB struct, e.g. data{1}, data{2}, etc. Then you can just enter that structure in the FieldTrip functions that take multiple dataset such as ft_timelockgrandaverage and ft_freqanalysis, with e.g. timelockgrandaverage(cfg,data{:})

Cheers,
stephen


From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Raquel bibi Cohen
Sent: 02 October 2015 06:17
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] ft_sourcegrandaverage

Hi Jia,
Here is the Matlab code I wrote to automate this work for a study when this came up as an issue for me.   I  don't have Matlab on my iPad ;)  forgive me  - the condition and trial types make my example unnecessarily  complicated.  In the following example replace commandA with ft_source... This assumes you have loaded the individual data into the workspace, and you're familiar with eval and sprintf.  It can be annoying trying to get it right the first time - but well worth it in the end.  I hope it helps you.
for itype = 1:3% loop over the target, predistractor, postdistractor, for shifting the timelock data and two distractor types conditions
for icond = 1:4 % congruent incongruent neutral
%cfg.keeptrials = 'yes';
commandA = ['grand_avg_A(' int2str(floor((itask+1)/2)) ',' int2str(itype) ',' int2str(icond) ') = ft_timelockgrandaverage(cfg'];
for isub = 1:length(subj)
commandA = [commandA sprintf(',%stimelock{%d,%d,%d}', subj{isub}, floor((itask+1)/2), itype, icond)]; %all subject grand average
ends
commandA = [commandA ')'];
cfg=[];
cfg.keepindividual = 'yes';
cfg.latency = [-.4 1];
eval(commandA)
end

Sent from my iPad

On Sep 30, 2015, at 10:54 AM, Wu, Jia <jia.wu at yale.edu<mailto: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<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.science.ru.nl_mailman_listinfo_fieldtrip&d=AwMGaQ&c=-dg2m7zWuuDZ0MUcV7Sdqw&r=9ehCplyXHP0-m9ayYv1FOg&m=X_Ba2i9uTsO9b6i8zWZpNwM_csfMuTfMf3JxbrHNKBI&s=tuHppNIb7jNr1tK_VR6PHlQuOXEY3DltZRA8QKs_XsE&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151002/47ec04a2/attachment-0002.html>


More information about the fieldtrip mailing list