[Eeglablist] Time frequency decomposition for 4 subjects across 4 electrodes
Mariam Hovhannisyan
mariam.hovhannisyan at duke.edu
Thu Jun 13 13:33:59 PDT 2019
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
More information about the eeglablist
mailing list