[Eeglablist] Time frequency decomposition for 4 subjects across 4 electrodes

Downey, Ryan J RDowney at bme.ufl.edu
Fri Jun 14 06:39:37 PDT 2019


Besides debugging as Matt mentioned, you could also try taking all of your set files and making an EEG study set. That would allow you to calculate your ERSPs for all subjects automatically. You can then view the results via the GUI and do stats. Alternatively, you could locate the individual files it saves yourself and load them into matlab as if they were a .mat file. I believe the file names end in .datersp for channel-level ERSPs but they behave just like .mat files if you use the load function in matlab. 

Side note: there is a single line you can change in one of the eeglab scripts/functions to run a parallel loop across subjects when it calculates the ERSPs. All you do is change a "for" to a "parfor" and everything is calculated quicker assuming you have the necessary matlab toolbox. 


Ryan J. Downey
Postdoctoral Associate
Human Neuromechanics Laboratory
University of Florida



-----Original Message-----
From: eeglablist <eeglablist-bounces at sccn.ucsd.edu> On Behalf Of Matt Gerhold
Sent: Friday, June 14, 2019 7:59 AM
To: Mariam Hovhannisyan <mariam.hovhannisyan at duke.edu>
Cc: eeglablist at sccn.ucsd.edu
Subject: Re: [Eeglablist] Time frequency decomposition for 4 subjects across 4 electrodes

Mariam:

Generally speaking, *index exceeds matrix dimensions* is a generic MATLAB exception that is thrown when the looping index exceeds the length of the data-structures you are indexing, whether they be arrays, matrices, or structures. So, it’s either the upper limit of your for loops, or you are indexing structures incorrectly.

Try scan through your code in debug mode and look at the structures in your workspace to see where you have gone wrong.
https://urldefense.proofpoint.com/v2/url?u=https-3A__uk.mathworks.com_help_matlab_matlab-5Fprog_debugging-2Dprocess-2Dand-2Dfeatures.html&d=DwIGaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=Xqv3i1MFyNQV9dhuL1e9BtqA0SbF1UWmfPtBzxDT0xY&m=8R7RyzSAQ_n4pAisd7kW4bsdugUtqcPAIdAaw63g8NM&s=DkpJYWjFiSCuMBUDkYQVi0g4QxZRy7d7APQncJ2HKVg&e= 

Rgds,

Matt

On Fri, Jun 14, 2019 at 12:03 PM Mariam Hovhannisyan < mariam.hovhannisyan at duke.edu> wrote:

> Hi,
>
>
> I am trying to compute time frequency for 4 subjects for 4 different 
> electrodes. I am using the pop_newtimef function and am attempting to 
> loop through the ALLEEG structure to access each subject's EEG data. 
> However, I am receiving an error message: index exceeds matrix 
> dimensions. Please see my code below. The star indicates the line that produces this error message:
>
>
> for j = 1:size(ALLEEG,2)
>
>     electrodes = [5 6 7 8];
>
>     nbchan = size(electrodes,2);
>
>     for elec = 1:nbchan
>
>        * [ersp,itc,powbase,times,freqs,erspboot,itcboot] = 
> pop_newtimef(ALLEEG(j),1, electrodes(elec), [ALLEEG(j).xmin 
> ALLEEG(j).xmax]*1000, [3 0.5],'maxfreq', 22, 'padratio', 16,  
> 'plotphase', 'off', 'timesout', 60, 'plotersp','off', 
> 'plotitc','off');
>
>         if elec == 1  % create empty arrays if first electrode
>
>             allersp = zeros([ size(ersp) nbchan]);
>
>             allitc = zeros([ size(itc) nbchan]);
>
>             allpowbase = zeros([ size(powbase) nbchan]);
>
>             alltimes = zeros([ size(times) nbchan]);
>
>             allfreqs = zeros([ size(freqs) nbchan]);
>
>             allerspboot = zeros([ size(erspboot) nbchan]);
>
>             allitcboot = zeros([ size(itcboot) nbchan]);
>
>         end
>
>         allersp (:,:,elec) = ersp;
>
>         allitc (:,:,elec) = itc;
>
>         allpowbase (:,:,elec) = powbase;
>
>         alltimes (:,:,elec) = times;
>
>         allfreqs (:,:,elec) = freqs;
>
>         allerspboot (:,:,elec) = erspboot;
>
>         allitcboot (:,:,elec) = itcboot;
>
>
>
>         ersp_subj{j} = allersp;
>
>         times_subj{j} = alltimes(:,:,1);
>
>         freqs_subj{j} = allfreqs(:,:,1);
>
>     end
>
> end
>
>
>
> Is there a simpler or different way to do this in EEGLab?
>
>
> Best,
>
> Mariam Hovhannisyan
>
> Research Technician
>
> Department of Neurology
>
> Center for Cognitive Neuroscience
>
> Duke University
>
>
> _______________________________________________
> Eeglablist page: 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__sccn.ucsd.edu_eegl
> ab_eeglabmail.html&d=DwIGaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=Xqv3i1MFyNQV9dh
> uL1e9BtqA0SbF1UWmfPtBzxDT0xY&m=8R7RyzSAQ_n4pAisd7kW4bsdugUtqcPAIdAaw63
> g8NM&s=oeoFoA8HvJZnGTiuJgDpVV_k0GYXpkmeZcq5Bshxn_c&e=
> To unsubscribe, send an empty email to 
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to 
> eeglablist-request at sccn.ucsd.edu
>
_______________________________________________
Eeglablist page: https://urldefense.proofpoint.com/v2/url?u=http-3A__sccn.ucsd.edu_eeglab_eeglabmail.html&d=DwIGaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=Xqv3i1MFyNQV9dhuL1e9BtqA0SbF1UWmfPtBzxDT0xY&m=8R7RyzSAQ_n4pAisd7kW4bsdugUtqcPAIdAaw63g8NM&s=oeoFoA8HvJZnGTiuJgDpVV_k0GYXpkmeZcq5Bshxn_c&e=
To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu


More information about the eeglablist mailing list