# Problem running source grand average and source statistics

Michael Wibral michael.wibral at WEB.DE
Tue Nov 4 18:35:40 CET 2008

```Dear list users,

I am having a problem running, source grandaverage and source statistics (over multiple subjects) on the output of soucrestatistictics (from multiple trials in single subjects).

I ran first sourceanalysis supplying the backwads warped grids (as described in the wiki) to compute filters. Then I ran source analysis again to extract the single trial source images and the ran sourcestatistitics on this to get the single subject statistical images - all this runs fine. I then supply the pos (and dim) data of the template grid to each structure, replacing the original pos data (that do not match and of course prohibit using sourceststatistics and sourcegrandaverage). When trying to do either a source grand average or a sourcestatistics at the multisubject level I get the same error:

subscripted assignment dimension mismatch
dat(:,i) = tmp(:);

Error in ==> sourcegrandaverage at 173

The corresponding lines of code in sourcegrandaverage are:

% get the source parameter from each input source reconstruction
% get the inside parameter from each input source reconstruction
for i=1:Nsubject
% TODO this function should use parameterselection
if issubfield(varargin{i}, ['avg.' cfg.parameter])
tmp = getsubfield(varargin{i}, ['avg.' cfg.parameter]);
else
tmp = getsubfield(varargin{i}, cfg.parameter);
end
dat(:,i) = tmp(:);
tmp = getsubfield(varargin{i}, 'inside');
inside(tmp,i) = 1;
end

I get an identical error when using sourcestatistics at the multisubject level.
The variable dat(:,i)  is created like this:
dat = zeros(Nvoxel, Nsubject)

I suspect that somehow trying to use the 'stat' instead of the power parameter is a problem (TODO?) or that Nvoxel somehow differs over the various subjects ??

Any advice on what to try and test further would very much appreciated.

Michael

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Michael Wibral.vcf
Type: text/x-vcard
Size: 344 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20081104/05bae09f/attachment-0001.vcf>
```