<div dir="ltr">Hi Nietzsche,<div><br><div>Thanks for the suggestion, but unfortunately that's not what's going wrong. My input data is a subject-by-condition array, so if I fill in sourcedat{:,1} and sourcedat{:,2}, that would be equivalent to having two separate variables and do source_condition1{:},source_condition2{:}. I tried that but I get the same error "??? Reference to non-existent field 'pos'."</div>
<div><br></div><div>In fact, the error is I think a bug of the newest fieldtrip version, because when I tried an older version (fieldtrip-20131031), it works (although it later crashes on a design array issue, but that's something I have to figure out myself ;)).</div>
</div><div><br></div><div>The 'pos' field is a field that is present in the output of ft_sourceanalysis; according to the help it's a N-by-3 matrix of the x-y-z position of all the sources, where N is the sum of the length of the 'inside' and 'outside' fields.</div>
<div>This 'pos' field is removed in further steps (ft_sourceinterpolate). When calling ft_sourceanalysis in version fieldtrip-20140109, the function statistics_wrapper searches for this field (line 228) and can't find it.</div>
<div><br></div><div>Chrs,</div><div><br></div><div>- Joram</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 24, 2014 at 9:55 AM, Lam, Nietzsche <span dir="ltr"><<a href="mailto:n.lam@fcdonders.ru.nl" target="_blank">n.lam@fcdonders.ru.nl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Joram,<br>
<br>
I'm not entirely sure if this is the solution, but when you call ft_sourcestatistics, you can try this:<br>
<br>
<stat = ft_sourcestatistics(cfg,sourceDiffNorm{:}, sourceDiffNorm{:})><br>
<br>
FieldTrip statistics functions understands that you want to use the data from all subjects when you use {:}, so there's no need to call individual columns with {:,X}.<br>
<br>
Best,<br>
Nietzsche<br>
<div><div class="h5"><br>
<br>
<br>
----- Original Message -----<br>
> From: "Joram van Driel" <<a href="mailto:joramvandriel@gmail.com">joramvandriel@gmail.com</a>><br>
> To: "FieldTrip discussion list" <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>><br>
> Sent: Friday, 24 January, 2014 8:54:24 AM<br>
> Subject: [FieldTrip] ft_sourcestatistics cannot find field 'pos'<br>
> Hi all,<br>
><br>
><br>
> I'm getting stuck with ft_sourcestatistics.<br>
> I want to do a simple two-condition contrast on neuromag MEG data,<br>
> where I did frequency beamforming on a pre vs. post tf-window.<br>
><br>
><br>
> I followed the instructions of the tutorial, so for each subject and<br>
> condition:<br>
><br>
><br>
> 1) ft_sourceanalysis with subject-specific vol and grid structures,<br>
> where I did the pre vs post contrast as follows:<br>
><br>
><br>
><br>
> sourceAll = ft_sourceanalysis(cfg, freqAll(condi));<br>
><br>
> cfg.grid.filter = sourceAll.avg.filter;<br>
> sourcePre_con = ft_sourceanalysis(cfg, freqPre(condi) );<br>
> sourcePost_con = ft_sourceanalysis(cfg, freqPost(condi));<br>
><br>
><br>
><br>
> sourceDiff(condi) = sourcePost_con;<br>
> sourceDiff(condi).avg.pow = (sourcePost_con.avg.pow -<br>
> sourcePre_con.avg.pow) ./ sourcePre_con.avg.pow;<br>
><br>
><br>
> 2) ft_sourceinterpolate with the subject-specific mri<br>
> 3) ft_volumenormalize to MNI with coordsys 'neuromag'.<br>
> 4) The output is stored in a subject-by-condition cell array, which I<br>
> put into ft_sourcestatistics with the following cfg:<br>
><br>
><br>
><br>
> cfg = [];<br>
> cfg.parameter = 'avg.pow';<br>
> cfg.method = 'analytic';<br>
> cfg.statistic = 'depsamplesT';<br>
> cfg.correctm = 'no';<br>
> cfg.alpha = 0.05;<br>
><br>
><br>
> Nsub = 10;<br>
> cfg.design(1,1:2*Nsub) = [ones(1,Nsub) 2*ones(1,Nsub)];<br>
> cfg.design(2,1:2*Nsub) = [1:Nsub 1:Nsub];<br>
> cfg.tail = 0; % number, -1, 1 or 0 (default = 0)<br>
> cfg.ivar = 1; % number or list with indices, independent variable(s)<br>
> cfg.uvar = 2; % number or list with indices, unit variable(s)<br>
><br>
><br>
> stat = ft_sourcestatistics(cfg,sourceDiffNorm{:,1},<br>
> sourceDiffNorm{:,2});<br>
><br>
><br>
><br>
><br>
> This results in the error that it cannot find the field 'pos'; however<br>
> this field is only present in the result from ft_sourceanalysis (and<br>
> differs for each subject), but disappears as soon as<br>
> ft_sourceinterpolate is applied. I tried to put the result from<br>
> ft_sourceanalysis straight into ft_sourcestatistics (which according<br>
> to the help should be possible), but this doesn't recognize the input<br>
> as volume data (and apart from that, the subjects aren't spatially<br>
> aligned this way).<br>
><br>
><br>
> I hope someone can help me with this; any help is much appreciated!<br>
><br>
><br>
> Thanks,<br>
> Joram<br>
><br>
><br>
> --<br>
><br>
> Joram van Driel, MSc.<br>
> PhD student @ University of Amsterdam<br>
> Brain & Cognition @ Department of Psychology<br>
</div></div>> _______________________________________________<br>
> fieldtrip mailing list<br>
> <a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<br>
--<br>
Nietzsche H.L. Lam, MSc<br>
PhD Candidate<br>
<br>
Max Planck Institute for Psycholinguistics<br>
Wundtlaan 1, 6525 XD Nijmegen, The Netherlands<br>
<br>
Donders Institute for Brain, Cognition and Behaviour,<br>
Centre for Cognitive Neuroimaging,<br>
Kapittelweg 29, 6525EN Nijmegen, The Netherlands<br>
<br>
<a href="mailto:n.lam@fcdonders.ru.nl">n.lam@fcdonders.ru.nl</a><br>
<a href="tel:%2B31-24-3668219" value="+31243668219">+31-24-3668219</a><br>
<br>
<br>
<a href="http://neurobiologyoflanguage.com" target="_blank">neurobiologyoflanguage.com</a><br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Joram van Driel, MSc.<div>PhD student @ University of Amsterdam</div><div>Brain & Cognition @ Department of Psychology</div></div>
</div>