[FieldTrip] Error with interpn when calling ft_sourceinterpolate

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Fri Mar 25 10:16:12 CET 2016


Hi Gina,

What version of MATLAB and operating system are you using? I cannot get your error reproduced, and from the message it seems a low-level MATLAB thing, because it complains about the number of input arguments to a function that is provided by MATLAB. (by the way, the error message that you got refers to line 152 in interpn, the same error check is done in my version of interpn at line 151…., which suggests a different version of the m-file. I was using matlab2014b on a windows machine)

Best,
Jan-Mathijs



> On 24 Mar 2016, at 12:30, gj <gina.joue at univr.it> wrote:
> 
> Hi FieldTrip community,
> 
> I am using FieldTrip ver.20160309 and am getting the error:
> 
> 	Error using interpn (line 152)
> 	Wrong number of input arguments.
> 
> 	Error in ft_sourceinterpolate>my_interpn (line 673)
> 	av(sel) = interpn(fv, ax(sel), ay(sel), az(sel), interpmethod);
> 
> while trying to interpolate onto a template brain after having done source reconstruction. This question had been posted before several years ago but don't know how to "fix" the problem:
> 
> http://mailman.science.ru.nl/pipermail/fieldtrip/2013-March/006347.html
> 
> Here is my code leading to the error when calling ft_sourceinterpolate:
> 
> %-- snippet--%
> % sensor level Fourier spectra
> cfg = [];
> cfg.method = 'mtmfft';
> cfg.output = 'fourier';
> cfg.keeptrials = 'yes';
> cfg.tapsmofrq = 2;
> cfg.foi = 13;
> freqsens = ft_freqanalysis(cfg, data);
> 
> % source reconstruction
> cfg = [];
> cfg.frequency = freqsens.freq;
> cfg.elec = elec;
> cfg.method = 'eloreta';
> cfg.grid = lf;
> cfg.vol = vol;
> cfg.keeptrials = 'yes';
> cfg.rawtrial = 'yes';
> source = ft_sourceanalysis(cfg, freqsens);
> 
> % project to direction explaining most source variance
> cfg = [];
> cfg.projectmom = 'yes';
> source_proj = ft_sourcedescriptives(cfg,source);
> 
> source_proj.dim = template_grid.sourcemodel.dim;
> source_proj.pos = template_grid.sourcemodel.pos;
> 
> %%....... interpolate onto the MNI template brain
> cfg = [];
> cfg.voxelcoord = 'no';
> cfg.parameter = 'avg.pow';
> cfg.interpmethod = 'nearest';
> source_int = ft_sourceinterpolate(cfg, source_proj, template_mri);
> 
> %-- end snippet--%
> 
> 
> Any help greatly appreciated!
> Gina
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip





More information about the fieldtrip mailing list