[FieldTrip] Problem with ft_megrealign

Kirsten Herfurth kirsten at carrot-village.de
Tue Nov 7 12:16:51 CET 2017

Dear all,

I would like to apply the function ft_megrealign to my single subject meg data in order to do sensor level group analysis afterwards. I got stuck with the following error messages:

Reference to non-existent field 'xgrid'.
Error in ft_prepare_sourcemodel (line 709)
  xmin_indx = find(grid.xgrid==xmin);
Error in ft_megrealign (line 249)
grid = ft_prepare_sourcemodel(tmpcfg);

I used the following configuration:
cfg.template = {MEGSubject1.grad; MEGSubject2.grad; MEGSubject3.grad, …}; 
cfg.headmodel = headmodel; 
cfg.headshape = strcat(Path2MEGData,'hs_file');
cfg.inwardshift = 0.025; % in meters
[MEGSubject1_realigned] = ft_megrealign(cfg, MEGSubject1) 

The headmodel was built using the following configuration:
cfg =[];
cfg.method  = 'localspheres';
cfg.grad = MEGsingleSubjectData.grad;
headmodel = ft_prepare_headmodel(cfg, headshape); 

There was a post with the same problem in the mailing list, with the suggestion to uncomment cfg.headshape: https://mailman.science.ru.nl/pipermail/fieldtrip/2015-September/009633.html

When uncommenting cfg.headshape, it works until I get the following error message:

Error using vertcat
Dimensions of matrices being concatenated are not consistent.
Error in ft_megrealign (line 391)
  interp.label = [interp.label; rest.label]; 

interpol.label is a 1x248 cell array, rest.label is 93x1 cell array.

Did I miss something?
Thanks a lot for your help in advance,


More information about the fieldtrip mailing list