[FieldTrip] source analysis- NaN in leadfield matrices

Doriana De Marco doriana.demarco at gmail.com
Sun Mar 22 18:22:23 CET 2015

Dear Fieldtrip members,

I’m dealing with source analysis and I have a big problem that I can’t

Filedtrip gives me an error after launching of ft_sourceanalysis:

??? Error using ==> svd

Input to SVD must not contain NaN or Inf.

Error in ==> rank at 15

s = svd(A);

Error in ==> ft_eloreta at 132

    rank_lf(i) = rank(dip.leadfield{i});

Error in ==> ft_sourceanalysis at 850

      dip(i) = ft_eloreta(grid, sens, vol, squeeze(avg(i,:,:)),


In my leadfield computation there are in fact many NaN points.  I report my
script below because I can’t find where the error can be.  I used
standard_mri template to prepare head model.



%if you have a structural mri and you want to create headmodel

%load headmodel – mri


cfg          = [];

cfg.output    = {'brain','skull','scalp'};

template_seg = ft_volumesegment(cfg, mri);

cfg          = [];

cfg.method   = 'bemcp';

template_vol = ft_prepare_headmodel(cfg, template_seg);

elec = ft_read_sens('GSN-HydroCel-128.sfp');

template_vol = ft_convert_units(template_vol, elec.unit);

cfg           = [];

cfg.method    = 'interactive';

cfg.elec      = elec;

cfg.headshape = template_vol.bnd(3);

elec_aligned  = ft_electroderealign(cfg);

cfg = [];

cfg.grid.unit = template_vol.unit;

cfg.elec = elec_aligned;

cfg.mri = mri;

cfg.vol = template_vol;

grid = ft_prepare_sourcemodel(cfg)

cfg                 = [];

cfg.elec            = elec_aligned;

cfg.vol             = template_vol;

cfg.reducerank      = 3;

cfg.grid            = grid;

cfg.channel         = {'all'};

cfg.grid.unit       = 'cm';

[grid] = ft_prepare_leadfield(cfg, data);

cfg              = [];

cfg.method       = 'eloreta';

cfg.grid         = grid;

cfg.elec         = elec_aligned;

cfg.vol          = template_vol;

source = ft_sourceanalysis(cfg, data);

I’m trying to analyze component data in order to localize comp.topo
parameter. I used the function comp2timelocked to transform data in a
timelock-like structure... I don’t know if it can be a problem.

I sincerely hope someone of you can help me

Many thanks


Doriana De Marco, Ph.D. Student
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150322/8ec423f0/attachment-0001.html>

More information about the fieldtrip mailing list