<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style><style type="text/css"></style>
</head>
<body style="word-wrap:break-word" fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div style="color: rgb(0, 0, 0); font-size: 16px;">
<div style="font-family: 'Times New Roman';">Hi Emma,</div>
<div style="font-family: 'Times New Roman';"><br>
</div>
<div style="font-family: 'Times New Roman';">In this part:</div>
<div>
<blockquote type="cite">
<div dir="ltr" style="font-family: 'Times New Roman';"><span style="color: rgb(255, 0, 0);">??? Undefined function or method 'fieldnames' for input arguments of type 'double'.</span></div>
<div dir="ltr" style="font-family: 'Times New Roman';"><br>
</div>
<div dir="ltr" style="font-family: 'Times New Roman';"><span style="color: rgb(255, 0, 0);"><br>
Error in ==> parameterselection at 47<br>
    tmp = fieldnames(data.avg);</span></div>
<div dir="ltr" style="font-family: 'Times New Roman';"><br>
</div>
<div dir="ltr" style="font-family: 'Times New Roman';">it says that the function 'fieldnames' doesn't know how to deal with data that is of the type double.  This is because fieldnames expects your data to be in the format of a struct.  I'm guessing there was
 just an error in your implementation because from your message you understood that "input data to ft_sourcegrandaverage contains a cell array of structures -- ones for each participant.  Furthermore, you need to put your source estimates in data.pow.avg.</div>
<div dir="ltr" style="font-family: 'Times New Roman';"><br>
</div>
<div dir="ltr" style="font-family: 'Times New Roman';">Based on your description, you might try something like this (but it's not guaranteed to work because I'm not entirely sure about the details of your data)</div>
<div dir="ltr" style="font-family: 'Times New Roman';"><br>
</div>
<div dir="ltr" style="font-family: 'Times New Roman';">data.pos = [902629x3  double]<br>
data.dim = [91 109 91]</div>
<div dir="ltr" style="font-family: 'Times New Roman';">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 x time points, depending on your data).</div>
<div dir="ltr" style="font-family: 'Times New Roman';"><br>
</div>
<div dir="ltr" style="font-family: 'Times New Roman';">As a side note, the size of your data will be quite taxing on computational memory so you might also want to consider using a lower spatial resolution.</div>
<div dir="ltr" style="font-family: 'Times New Roman';"><br>
</div>
<div dir="ltr" style="font-family: 'Times New Roman';">Finally, in the future, when describing your data, it would be best to show the structure of your data as shown in matlab (as done above), because this makes it easier for everyone else to see what you've
 done.  Please check this FAQ for more details http://fieldtrip.fcdonders.nl/faq/how_to_ask_good_questions_to_the_community<a href="http://fieldtrip.fcdonders.nl/faq/how_to_ask_good_questions_to_the_community" target="_blank" style="font-family: Tahoma;">http://fieldtrip.fcdonders.nl/faq/how_to_ask_good_questions_to_the_community</a></div>
<div dir="ltr" style="font-family: 'Times New Roman';"><br>
</div>
<div dir="ltr" style="font-family: 'Times New Roman';">Best,</div>
<div dir="ltr" style="font-family: 'Times New Roman';">Nietzsche </div>
</blockquote>
</div>
<div style="font-family: 'Times New Roman';">
<div>
<div>
<div><br>
</div>
<blockquote type="cite">
<div style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px">
<span style="font-family:'Helvetica'"><b>From: </b></span><span style="font-family:'Helvetica'">Emma Holmes <<a href="mailto:eh776@york.ac.uk" target="_blank">eh776@york.ac.uk</a>><br>
</span></div>
<div style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px">
<span style="font-family:'Helvetica'"><b>Subject: </b></span><span style="font-family:'Helvetica'"><b>[FieldTrip] Spatio-temporal cluster-based permutation analysis on EEG sources</b><br>
</span></div>
<div style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px">
<span style="font-family:'Helvetica'"><b>Date: </b></span><span style="font-family:'Helvetica'">October 31, 2014 at 1:19:18 PM GMT+1<br>
</span></div>
<div style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px">
<span style="font-family:'Helvetica'"><b>To: </b></span><span style="font-family:'Helvetica'"><<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>><br>
</span></div>
<div style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px">
<span style="font-family:'Helvetica'"><b>Reply-To: </b></span><span style="font-family:'Helvetica'">FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>><br>
</span></div>
<br>
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>Dear all,<br>
<br>
</div>
I am trying to perform spatio-temporal cluster statistics to the sources of an EEG dataset, which I localised using the SPM8 toolbox.<br>
</div>
For each participant (averaged across trials), I have a .nii image containing the source reconstruction for each of two conditions at multiple different time points. Each nifti file contains a matrix of 91 x 109 x 91, which corresponds to the source estimates
 at each voxel.</div>
My aim is to identify sources of activity that span large clusters of voxels and/or time points, similar to what I have done previously with the scalp data.<br>
<br>
</div>
I understand that the function 'ft_sourcestatistics' should be able to achieve this with the data output from the function 'ft_sourcegrandaverage'.<br>
</div>
<div>However, I am having difficulty structuring the data from the nifti files in a format that can be successfully input to 'ft_sourcegrandaverage'.<br>
<br>
</div>
<div></div>
<div>The data that I am trying to input to 'ft_sourcegrandaverage' contains a cell array of structures--one for each participant.<br>
</div>
<div>As far as I understand from the documentation, each structure should contain a 'pos' field, which specifies the [x y z] co-ordinates for each position in the matrix (in my case, a matrix of size 91*109*91 x 3).<br>
</div>
<div>I have also included a 'time' field, containing a vector of the time points to which each .nii image corresponds and a 'dim' field containing the vector [91 109 91].<br>
</div>
<div><br>
Could you please let me know whether or not this is correct and in which field(s) I should subsequently add the source reconstruction estimates at each time point.
<br>
</div>
<div>So far, I have tried including an 'avg' field with the data at each time point (91 x 109 x 91 x ntps).<br>
</div>
<div>However, when I do so, I get the following error:<br>
<br>
<span style="color:rgb(255,0,0)">??? Undefined function or method 'fieldnames' for input arguments of type 'double'.<br>
<br>
Error in ==> parameterselection at 47<br>
    tmp = fieldnames(data.avg);<br>
<br>
Error in ==> ft_checkdata at 578<br>
  param = setdiff(parameterselection('all', data), exclude);<br>
<br>
Error in ==> ft_sourcegrandaverage at 81<br>
  varargin{i} = ft_checkdata(varargin{i}, 'datatype', {'source'}, 'feedback', 'no',<br>
  'inside', 'logical', 'sourcerepresentation', 'new');</span><br>
<br>
</div>
<div>I am using matlab version 7.7.0.471 (R2008b) and fieldtrip-20140415 (although I have also tried other fieldtrip versions).<br>
<br>
</div>
<div>Any help would be greatly appreciated.<br>
<br>
</div>
<div>Best wishes,<br>
Emma<br>
<br>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>