<div dir="ltr"><div><div><div><div><div><div><div>Dear all, <br><br></div>I'm trying to compute 'pcc' beamforming source analysis of eeg data, but I have an error when calling ft_sourceinterpolate:<br><br><i> Reference to non-existent field 'avg'.<br>Error in getsubfield (line 45)<br>  s = s.(t{k});<br>Error in ft_sourceinterpolate (line 209)<br>  if ~iscell(getsubfield(functional, cfg.parameter{i}))</i><br><br><br></div>If I check my source structure I do have the avg field. <br><br>source = <br>freq: 10<br>cumtapcnt: [157x1 double]<br>dim: [18 21 18]<br>inside: [6804x1 logical]<br>pos: [6804x3 double]<br>method: 'average'<br>avg: [1x1 struct]<br>cfg: [1x1 struct]<br><br><br></div>Any suggestion? <br><br></div>Thank you for your help!<br></div>Best,<br></div>fosco<br><br><br></div>here the rest of my code:<br><br><br>load('standard_bem.mat');<br>load('standard_sourcemodel3d10mm.mat');<br><br>templatefile = '/home/sv/Matlabtoolboxes/fieldtrip-20160306/template/anatomy/single_subj_T1.nii';<br>template_mri = ft_read_mri(templatefile);<br>template_mri = ft_convert_units(template_mri,'mm');<br>template_mri.coordsys = 'spm';<br><br>cfg = [];<br>cfg.grid.warpmni = 'yes';<br>cfg.grid.template  = sourcemodel;<br>cfg.grid.nonlinear = 'yes'; % use non-linear normalization<br>cfg.mri      = template_mri;<br>sourcemodel  = ft_prepare_sourcemodel(cfg,freq);<br>sourcemodel  = ft_convert_units(sourcemodel,'mm');<br><br>cfg         = [];<br>cfg.elec    = sens;<br>cfg.channel = sens.label;<br>cfg.headmodel = vol;<br>cfg.grid      = sourcemodel;<br>cfg.grid.unit = 'mm';% same unit as above, i.e. in cm<br>lf = ft_prepare_leadfield(cfg,freq);<br><br>cfg            = [];<br>cfg.method     = 'mtmfft';<br>cfg.output     = 'fourier';<br>cfg.keeptrials = 'yes';<br>cfg.tapsmofrq  = 2;<br>cfg.foi        = 10;<br>freq           = ft_freqanalysis(cfg,dataft{1,1});<br><br>% compute source reconstruction<br>cfg   = [];<br>cfg.frequency = freq.freq;<br>cfg.method    = 'pcc';<br>cfg.grid         = lf;<br>cfg.headmodel         = vol;<br>cfg.keeptrials        = 'yes';<br>cfg.pcc.lambda        = '5%';<br>cfg.pcc.projectnoise  = 'yes';<br>source = ft_sourceanalysis(cfg,freq);<br><br>cfg = [];<br>cfg.projectmom = 'yes';<br>source_proj = ft_sourcedescriptives(cfg,source);<br><br>% and provide  mni template <br>source_proj.dim = sourcemodel.dim;<br>source_proj.pos = sourcemodel.pos;<br><br>cfg  = [];<br>cfg.voxelcoord   = 'no';<br>cfg.parameter    = 'avg.nai';<br>source_int  = ft_sourceinterpolate(cfg,source,template_mri);<br><br></div>