[FieldTrip] Error in source localisation statistics

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Tue Feb 19 14:54:56 CET 2019


Hi Xavier,

My recommendation here would be to use the matlab debugger and inspect the cause of the error. The ‘Index exceeds array bounds’ is quite a clear error message, and suggests that there is a mismatch between the number of elements in dat/val, and the numbers represented in indx(k).

Good luck,

Jan-Mathijs


On 18 Feb 2019, at 07:23, Xavier Vrijdag <x.vrijdag at auckland.ac.nz<mailto:x.vrijdag at auckland.ac.nz>> wrote:

Hello,

I have a dataset from an experiment where 12 participants were exposed to 3 levels of nitrous oxide, while I measured their EEG. I also have a baseline recording. I took for each exposure (and baseline) a 1 minute sample for further analysis. I want to do source localization to better understand  which parts of the brain are involved. I don’t have MRI scans of my participants, so I used the standard MRI and BEM. I would like to thanks the persons who made the various manuals and analysis examples on the website, as they helped me tremendously to do this analysis.

After cleaning and preprocessing, I combined the datasets into one for further analysis. I also chose to make 5 sec “trials” for further analysis. For this source analysis I loaded the data of 1 exposure and the baseline data, to compare them.

        %Calculate the channel covariance matric
        cfg = [];
        cfg.covariance = 'yes';
        cfg.covariancewindow = 'all';
        cfg.keeptrials  = 'yes';
        timelock = ft_timelockanalysis(cfg, data_filt);

        %Global filter
        cfg = [];
        cfg.headmodel = vol;
        cfg.elec = elec_aligned;
        cfg.grid = grid;
        cfg.method = 'lcmv';
        cfg.lcmv.projectnoise='yes'; %needed for neural activity index
        cfg.lcmv.fixedori = 'yes';  %Project onto largest variance orientation
        cfg.lcmv.keepfilter = 'yes'; %Keep the beamformer weights
        cfg.lcmv.lambda = '5%'; %Regularise a little
        cfg.rawtrial    = 'yes';      % project each single trial through the filter.
        cfg.keeptrials  = 'yes';
        source = ft_sourceanalysis(cfg, timelock);

        cfg = [];
        cfg.dim         = source.dim;
        cfg.method      = 'montecarlo';
        cfg.statistic   = 'ft_statfun_indepsamplesT';
        cfg.parameter   = 'pow';
        cfg.correctm    = 'cluster';
        cfg.numrandomization = 1000;
        cfg.alpha       = 0.05; % note that this only implies single-sided testing
        cfg.tail        = 0;
        cfg.design(1,:) = [1:nTrials 1:nTrials];
        cfg.design(2,:) = [ones(1,nTrials) ones(1,nTrials).*2];
        cfg.uvar        = 1; % row of design matrix that contains unit variable (in this case: trials)
        cfg.ivar        = 2; % row of design matrix that contains independent variable (the conditions)
        stat = ft_sourcestatistics(cfg, source);

After the source analysis the source statistics script calls the checkdata script and I get the following error:

Index exceeds array bounds.

Error in ft_datatype_source (line 183)
            val{indx(k)}(1,:,:,:) = dat{indx(k)};

Error in ft_checkdata (line 278)
  data = ft_datatype_source(data);

Error in ft_sourcestatistics (line 94)
  varargin{i} = ft_checkdata(varargin{i}, 'datatype', 'source', 'feedback', 'no');

Error in sourcelocalisation_N2O (line 114)
        stat = ft_sourcestatistics(cfg, source);

The source struct has the following content:
      time: [1×15360 double]
       dim: [24 31 25]
    inside: [18600×1 logical]
       pos: [18600×3 double]
    method: 'rawtrial'
     trial: [1×24 struct]
        df: 24
       cfg: [1×1 struct]

With source.trial:
  1×24 struct array with fields:
    ori
    pow
    mom
    noise
    filter
    label
    filterdimord

I would like your help to understand the error and how to fix it.

Regards,

Xavier Vrijdag

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190219/498c7643/attachment-0002.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list