[Eeglablist] Problem with newtimeftrialbaseln.m

Klatt, Laura Klatt at ifado.de
Thu Jan 6 06:20:43 PST 2022


Hi all,

I encounter a problem with the newtimeftrialbaseln() function when I want to load erspdata using std_erspplot().

Specifically, I created a STUDY design and precomputed ERSPs. In order to load the data to plot topographies, I then run the following lines of code (using EEGLAB v2021.1 and MATLAB R2021b):

EEG=ALLEEG(1);
electrodes = {EEG.chanlocs.labels};
[STUDY, erspdata, ersptimes, erspfreqs] = std_erspplot(STUDY,ALLEEG,'channels',electrodes, 'noplot', 'on');

And I get this error message:

Index in position 3 exceeds array bounds. Index must not exceed 60.

Error in newtimeftrialbaseln (line 99)
            mbase = mean(P(:,:,tmpbase,:),3);

Error in std_readdata>processtf (line 412)
        dataout = newtimeftrialbaseln(P, xvals, g);

Error in std_readdata>@(x)processtf(x,xvals,opt.datatype,opt.singletrials,params) (line 246)
            dataTmp{iSubj} = cellfun(@(x)processtf(x, xvals, opt.datatype, opt.singletrials, params), dataTmp{iSubj}, 'uniformoutput', false);

Error in std_readdata (line 246)
            dataTmp{iSubj} = cellfun(@(x)processtf(x, xvals, opt.datatype, opt.singletrials, params), dataTmp{iSubj}, 'uniformoutput', false);

Error in std_erspplot (line 250)
    [STUDY, allersp, alltimes, allfreqs, events, paramsersp] = std_readdata(STUDY, ALLEEG, 'channels', opt.channels, 'timerange', params.timerange, ...

I tracked the error down to newtimeftrialbaseln. According to the documentation of newtimeftrialbaseln the tf input data should have the following the dimensions:
[freqs x times x trials] or [channels x freqs x times x trials].

However, it seems like the variable that causes the code to crash (variable P, see line 99) has the wrong order of dimensions. In my case it is [freq x times x trials x channels].
I cannot figure out why that is. The code runs fine if I am only trying to load data from one channel (i.e., when the input data is 3-dimensional: freqs x times x trials).

Of course I could simply reshape the variable P, but I’d rather not mess around in the build-in EEGLAB functions without understanding why that error occurs.

My current workaround is to only load one channel at a time, looping through my ‘electrodes’ variable until I have the data from all electrodes. But of course that is somewhat inefficient.

I appreciate any comments or hints.

Thanks a lot!
Best,
Laura




--
Dr. Laura-Isabelle Klatt
Leibniz Research Centre for Working Environment and Human Factors
Department of Ergonomics
Research Unit: Information processing
Ardeystr. 67
44139 Dortmund

Contact:
klatt at ifado.de
+49 / 231 1084 260
twitter: @LoraKlatt

Personal website: https://urldefense.proofpoint.com/v2/url?u=https-3A__lauraklatt.github.io_&d=DwIGaQ&c=-35OiAkTchMrZOngvJPOeA&r=kB5f6DjXkuOQpM1bq5OFA9kKiQyNm1p6x6e36h3EglE&m=GUFNy43aiGBdmL9h_EH-a80yMQL2HHeeV4Urh90aLbh0ZGAYi4GEAAGNIYaSsoeC&s=9acLLWra8mFUmhTluc4OlBgBCYwKWYfIiLMqSzoVW6M&e= 




More information about the eeglablist mailing list