[FieldTrip] Error with toilim in ft_entropyanalysis

Marta Stojanović marta.stojanovic at student.uva.nl
Fri Apr 21 11:08:48 CEST 2023


Hi Fieldtrip community,

I’m reaching out with an issue I receive when running ft_entropyanalysis. The error I receive pertains to the trial limits/how a trial is defined using ft_redefinetrial.

My data input to ft_entropyanalysis is a raw struct (or rather a dummy raw struct where I reshaped previous output to fit the ft_rawdatatype), with the essential fields of trial, time, and label. My data has 145 trials, so my trial and time fields are 1x145 cells. I parcellated MEG data in my project based on the Brainnetome atlas with 246 parcels, and the trials have 1018 timepoints. The fields in the trial 1x145 cell are therefore 246x1018 doubles, and in the time cell 1x1018 doubles. These shapes of the data should fit the desired input shapes.

I receive the following error when I run the function:

‘’’
Index in position 1 exceeds array bounds (must not exceed 1).

Error in ft_redefinetrial (line 180)
    if cfg.toilim(i,1)>data.time{i}(end) ||
    cfg.toilim(i,2)<data.time{i}(1)

Error in ft_entropyanalysis (line 279)
        data_sel = ft_redefinetrial(tmpcfg, data_filt);

Error in run_entropy (line 65)
mmse = ft_entropyanalysis(cfg,test_entropy);
‘’’
The error seems to arise as my requested cfg.toilim is beyond the timepoints that are in the data. The issue seems to arise on the last trial (145) for some reason, hence why i is 145. My time cell contains identical time points for all trials. Each 1x1018 double in the time cell contains the same time points in equal 2-second intervals starting from 0. There is no stimulus since I'm using resting-state data, but there are still arbitrary trials/start times for these trials.

Any suggestion will be greatly appreciated, thanks a lot in advance!

Best,
Marta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230421/68c13ac4/attachment.htm>


More information about the fieldtrip mailing list