<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=NL link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Emma,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Try using data{i}.avg.pow instead of data{i}.pow.avg<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>(or use cfg.funparameter    = 'pow.avg' instead of cfg.funparameter    = 'avg.pow')<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Best,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Stan<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> fieldtrip-bounces@science.ru.nl [mailto:fieldtrip-bounces@science.ru.nl] <b>On Behalf Of </b>Emma Holmes<br><b>Sent:</b> maandag 3 november 2014 12:04<br><b>To:</b> fieldtrip@science.ru.nl<br><b>Subject:</b> [FieldTrip] Spatio-temporal cluster-based permutation analysis on EEG sources<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><div><div><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Hi Nietzsche,<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>That's much clearer--thanks for your help. It seems as though I should have entered my sources estimates into data.pow.avg rather than data.avg.<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>However, I am still getting an error.<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>My data is structured:<br>data = <20x1 cell>                                % one cell array for each participant, n=20<br>data{i}.pos = [902629x3  double]            % x,y,z positions<br>data{i}.dim = [91 109 91]<br>data{i}.time = [1 x 11 double]                 % vector of time points<br>data{i}.pow.avg = [902629 x 11 double]    % source estimates<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>When I try: <br>     grandavgA = ft_sourcegrandaverage(cfg, data{:});<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>I get the error message:<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'><span style='color:red'>     ??? Error using ==> ft_checkdata>fixsource at 1259<br>     the input does not contain an avg or trial field<br><br>     Error in ==> ft_checkdata at 650<br>       data = fixsource(data, 'type', sourcerepresentation);<br><br>     Error in ==> ft_sourcegrandaverage at 107<br>       varargin{i} = ft_checkdata(varargin{i}, 'datatype', {'source'}, 'feedback', 'no',<br>       'inside', 'logical', 'sourcerepresentation', 'new');</span><o:p></o:p></p></div><p class=MsoNormal>It appears as though the function is searching for a data{i}.avg or data{i}.trial field. What data should these fields contain?<o:p></o:p></p></div><div><p class=MsoNormal>The wiki (<a href="http://fieldtrip.fcdonders.nl/reference/ft_datatype_source">http://fieldtrip.fcdonders.nl/reference/ft_datatype_source</a>) seems to state that these are "historical" fields, although I have updated to fieldtrip-20141030 (the same error also occurs with older versions)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Best,<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>Emma<br><br><o:p></o:p></p><div><div><div><div><div><div><p class=MsoNormal><br>On 31 October 2014 16:02, Lam, N.H.L. (Nietzsche) <<a href="mailto:n.lam@fcdonders.ru.nl">n.lam@fcdonders.ru.nl</a>> wrote:<br>> Hi Emma,<br>><br>> In this part:<br>> ??? Undefined function or method 'fieldnames' for input arguments of >type 'double'.<br>><br>><br>> Error in ==> parameterselection at 47<br>>     tmp = fieldnames(data.avg);<br>><br>> it says that the function 'fieldnames' doesn't know how to deal with data that is of the type <br>> double.  This is because fieldnames expects your data to be in the format of a struct.  I'm <br>> guessing there was just an error in your implementation because from your message you <br>> understood that "input data to ft_sourcegrandaverage contains a cell array of structures -- ones <br>> for each participant.  Furthermore, you need to put your source estimates in data.pow.avg.<br>> <br>> Based on your description, you might try something like this (but it's not guaranteed to work <br>> because I'm not entirely sure about the details of your data)<br>> <br>> data.pos = [902629x3  double]<br>> data.dim = [91 109 91]<br>> data.time = [1 x Z double]       %   vector of time points<br>> data.pow.avg = [902629 x time points]   %   source estimates (or potentially voxel x frequency <br>> x time points, depending on your data).<br>> <br>> As a side note, the size of your data will be quite taxing on computational memory so you <br>> might also want to consider using a lower spatial resolution.<br>> <br>> Finally, in the future, when describing your data, it would be best to show the structure of your <br>> data as shown in matlab (as done above), because this makes it easier for everyone else to <br>> see what you've done.  Please check this FAQ for more details <a href="http://fieldtrip.fcdonders.nl/faq/how_to_ask_good_questions_to_the_communityhttp:/fieldtrip.fcdonders.nl/faq/how_to_ask_good_questions_to_the_community" target="_blank">http://fieldtrip.fcdonders.nl/</a><br>> <a href="http://fieldtrip.fcdonders.nl/faq/how_to_ask_good_questions_to_the_communityhttp:/fieldtrip.fcdonders.nl/faq/how_to_ask_good_questions_to_the_community" target="_blank">faq/how_to_ask_good_questions_to_the_communityhttp://fieldtrip.fcdonders.nl/faq/</a><br>> <a href="http://fieldtrip.fcdonders.nl/faq/how_to_ask_good_questions_to_the_communityhttp:/fieldtrip.fcdonders.nl/faq/how_to_ask_good_questions_to_the_community" target="_blank">how_to_ask_good_questions_to_the_community</a><br>> <br>> Best,<br>> Nietzsche<o:p></o:p></p><div><div><div><p class=MsoNormal><br> <o:p></o:p></p></div></div></div></div></div></div></div></div></div></div></div></body></html>