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

Matt Gerhold matt.gerhold at gmail.com
Fri Jun 14 04:59:29 PDT 2019


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://uk.mathworks.com/help/matlab/matlab_prog/debugging-process-and-features.html

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: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> 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