[FieldTrip] Error with toilim in ft_entropyanalysis (Marta Stojanović)

Marta Stojanovic martastojanovic1 at net.hr
Fri Apr 21 12:53:59 CEST 2023


Hi Niels,
 
Thanks so much for your reply. I've managed to resolve the issue thanks to Julian Kosciessa's help in the meantime - the error was to do with how I set up cfg.timwin (it was a 2-element rather than 1-element vector for the time window). Thanks a lot for your suggestions nonetheless.
 
While I no longer receive the error I previously reached out with, I now have another error that I would appreciate your help with:
 
'''
Index exceeds the number of array elements (0).
 
Error in ft_entropyanalysis (line 315)
            nchan = size(data_sel_unfilt.trial{1},1);
'''
 
data_sel_unfilt is equal to the output of redefining the data using ft_redefinetrial: data_sel_unfilt = ft_redefinetrial(tmp cfg,data), line 299 in ft_entropyanalysis. My size(data_sel_unfilt.trial{1},1) is equal to 246 (the number of parcels).
 
I'm not sure why the number of array elements is 0 or where in the code to check that.
 
Thanks,
Best,
Marta
______________________________________________________________
 > Od: "Kloosterman, Niels via fieldtrip" <fieldtrip at science.ru.nl>
 > Za: "fieldtrip at science.ru.nl" <fieldtrip at science.ru.nl>
 > Datum: 21.04.2023 12:35
 > Naslov: Re: [FieldTrip] Error with toilim in ft_entropyanalysis (Marta Stojanović)
 >
Dear Marta,Thanks for your interest in ft_entropyanalysis. To answer your question it would be good to see the exact cfg structure that you used. The lines where your error occurs are for selecting particular timepoints in each trial for computing time-resolved entropy across the trials. For this a time window is selected around this time point and these segments are concatenated. It could be that a time point you requested goes outside the trial when the time window around it is applied. It could also be that your last trial is not complete (check for nans in data.trial{end}).    Hope this helps!Best,NielsDr. Niels KloostermanVertretungsprofessor in Algemeine Psychologie und Kognitive NeurowissenschaftenCharlotte Fresenius Hochschule Hamburgniels.kloosterman at charlotte-fresenius-uni.de <niels.kloosterman at charlotte-fresenius-uni.de>On 21. Apr 2023, at 12:00, fieldtrip-request at science.ru.nl wrote:

 Caution: This is an external email and may be malicious. Please take care when clicking links or opening attachments.
 
 
 
 Send fieldtrip mailing list submissions to
        fieldtrip at science.ru.nl
 
 To subscribe or unsubscribe via the World Wide Web, visit
        https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
 or, via email, send a message with subject or body 'help' to
        fieldtrip-request at science.ru.nl
 
 You can reach the person managing the list at
        fieldtrip-owner at science.ru.nl
 
 When replying, please edit your Subject line so it is more specific
 than "Re: Contents of fieldtrip digest..."
 
 
 Today's Topics:
 
   1. Error with toilim in ft_entropyanalysis (Marta Stojanović)
 
 
 ----------------------------------------------------------------------
 
 Message: 1
 Date: Fri, 21 Apr 2023 09:08:48 +0000
 From: Marta Stojanović <marta.stojanovic at student.uva.nl>
 To: "fieldtrip at science.ru.nl" <fieldtrip at science.ru.nl>
 Subject: [FieldTrip] Error with toilim in ft_entropyanalysis
 Message-ID: <47DC52D6-F510-45E9-AFF6-98AEF5F328BC at student.uva.nl>
 Content-Type: text/plain; charset="utf-8"
 
 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-0001.htm%3E
 
 ------------------------------
 
 Subject: Digest Footer
 
 _______________________________________________
 fieldtrip mailing list
 https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
 _______________________________________________
 fieldtrip mailing list
 https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
 https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!5grw-9pmw6cp_lD6dRSdtwJxiTi7gJbo5dHBe7xbJmHm8_8Em2wmjVWuX5Fuzqu9AMwaTYgcaBK5UDJs6hAdINmEgeeT5Ks$  <https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!8ev3VUJGCaaQBEzxwJCYWUi1upzTzwI11Ig_go6UIq7o4B68pQtUhVd9ZMRhyAvIl_z-qraaP6qS1-OE15N4WmK4CKPYaXfyaAUj$>
 
 
 ------------------------------
 
 End of fieldtrip Digest, Vol 149, Issue 14
 ******************************************
 
 
 ----------
 
 _______________________________________________
 fieldtrip mailing list
 https://mailman.science.ru.nl/mailman/listinfo/fieldtrip <https://mailman.science.ru.nl/mailman/listinfo/fieldtrip>
 https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!5grw-9pmw6cp_lD6dRSdtwJxiTi7gJbo5dHBe7xbJmHm8_8Em2wmjVWuX5Fuzqu9AMwaTYgcaBK5UDJs6hAdINmEgeeT5Ks$  <https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!5grw-9pmw6cp_lD6dRSdtwJxiTi7gJbo5dHBe7xbJmHm8_8Em2wmjVWuX5Fuzqu9AMwaTYgcaBK5UDJs6hAdINmEgeeT5Ks$ >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230421/43fb2811/attachment.htm>


More information about the fieldtrip mailing list