<span class="Apple-style-span" style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"><div><span class="Apple-style-span" style="color:rgb(34,34,34)">two corrections for eeglab list posting, below in </span><font class="Apple-style-span" color="#ff0000">red</font></div>

<div style="color:rgb(34,34,34)"><br></div><div style="color:rgb(34,34,34)">*************************BEGIN SAMPLE CODE<br><br></div><div><div style="color:rgb(34,34,34)"><font size="1"><br></font></div><div style="color:rgb(34,34,34)">

<font size="1">%this should run on epoched and unepoched files</font></div><div style="color:rgb(34,34,34)"><font size="1">%I did not modify settings further, nor examine function specifications</font></div><div style="color:rgb(34,34,34)">

<font size="1"><br></font></div><div style="color:rgb(34,34,34)"><font size="1">clear</font></div><div style="color:rgb(34,34,34)"><font size="1">clc</font></div><div style="color:rgb(34,34,34)"><font size="1">eeglab</font></div>

<div style="color:rgb(34,34,34)"><font size="1">cd ( '/Homedirectory/DirectoryNameYouwantTouseThatHasTheFiles/'); %directory should already exist and have all EEGLAB files</font></div><div style="color:rgb(34,34,34)">

<font size="1">filepath = pwd; %makes filepath the same as the directory with the files</font></div><div style="color:rgb(34,34,34)"><font size="1">%here you set up your lists of components, files, and frequencies to loop through</font></div>

<div style="color:rgb(34,34,34)"><font size="1">myListofComponents = [1,2,3,4,5];</font></div><div style="color:rgb(34,34,34)"><font size="1">myListofFiles = ['file1.set','file2.set','file3.set'];</font></div>

<div style="color:rgb(34,34,34)"><font size="1">myListOfFrequencies = [5,10,20]</font></div><div style="color:rgb(34,34,34)"><font size="1">percentageofFiletoAnalyze = 2; </font></div><div style="color:rgb(34,34,34)"><font size="1">for LoopThroughFiles = 1: length(myListofFiles) </font></div>

<div style="color:rgb(34,34,34)"><font size="1">    %begin file loop</font></div><div style="color:rgb(34,34,34)"><font size="1">currentfilename = myListofFiles(LoopThroughFiles);</font></div><div><font size="1"><font class="Apple-style-span" color="#222222">EEG = pop_loadset('filename',</font><font class="Apple-style-span" color="#ff0000"><b>currentfilename</b></font><font class="Apple-style-span" color="#222222">,'filepath',</font><font class="Apple-style-span" color="#222222">currentfilepath);</font></font></div>

<div style="color:rgb(34,34,34)"><font size="1">[ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 1 );</font></div><div style="color:rgb(34,34,34)"><font size="1"> for LoopThroughComponents = 1: length(myListofComponents) </font></div>

<div style="color:rgb(34,34,34)"><font size="1">     %begin component loop</font></div><div style="color:rgb(34,34,34)"><font size="1">currentcompA = myListofComponents(LoopThroughComponents);</font></div><div style="color:rgb(34,34,34)">

<font size="1">%set number of component of interest in current single subject single session file</font></div><div style="color:rgb(34,34,34)"><font size="1">for LoopThroughFrequencies = 1: length(myListofFrequencies) </font></div>

<div style="color:rgb(34,34,34)"><font size="1">    %begin frequency loop</font></div><div style="color:rgb(34,34,34)"><font size="1">currentfrequency = myListOfFrequencies(LoopThroughComponents); </font></div><div style="color:rgb(34,34,34)">

<font size="1">% set current frequency of interest</font></div><div style="color:rgb(34,34,34)"><font size="1">figure;  [spectra freqs speccomp] = pop_spectopo(EEG, 0, [0      EEG.xmax *1000], 'EEG' ...</font></div>

<div style="color:rgb(34,34,34)"><font size="1"> , 'freq', [currentfrequency], 'plotchan', 0, 'percent', percentageofFiletoAnalyze, 'icacomps', [currentcompA]...</font></div><div style="color:rgb(34,34,34)">

<font size="1">, 'nicamaps', 1, 'icamaps', [1], 'icamode',  'normal',  'freqrange',[8 12],'electrodes','off'); close(gcf);  </font></div><div style="color:rgb(34,34,34)">

<font size="1">%ignore figure I could not manage to turn it off</font></div><div style="color:rgb(34,34,34)"><font size="1">%freqs returns a column of numbers (freqs1),  %freqs(2), etc.... which specify the Hz for %each column in speccomp</font></div>

<div style="color:rgb(34,34,34)"><font size="1">newspecs=speccomp;newfreqs=freqs; %dump output to dummy holding variables</font></div><div style="color:rgb(34,34,34)"><font size="1">currentfilename1=currentfilename(1:5); %take first n characters of each filename</font></div>

<div style="color:rgb(34,34,34)"><font size="1">currentcompA1= num2str(currentcompA);</font></div><div style="color:rgb(34,34,34)"><font size="1"> v = genvarname([ 'speccomp' currentfilename1 currentcompA1 'hz']); eval([v ' = newspecs']);</font></div>

<div><font size="1"><font class="Apple-style-span" color="#222222">v2 = genvarname([ 'speccomp' currentfilename1 currentcompA1 'hz']); eval([</font><font class="Apple-style-span" color="#ff0000"><b>v2</b></font><font class="Apple-style-span" color="#222222"> ' = newfreqs']);</font></font></div>

<div style="color:rgb(34,34,34)"><font size="1">end %end frequency loop</font></div><div style="color:rgb(34,34,34)"><font size="1">end %end component loop</font></div><div style="color:rgb(34,34,34)"><font size="1">end %end file loop</font></div>

<div style="color:rgb(34,34,34)"><font size="1"><br></font></div><div style="color:rgb(34,34,34)"><font size="1">%NOTES TO GUY</font></div><div style="color:rgb(34,34,34)"><font size="1">%the above should provide a file in the workspace named [FileName_Component Number_ Frequency]</font></div>

<div style="color:rgb(34,34,34)"><font size="1">%the top row of each "speccompfileXhz" file contains the output for that</font></div><div style="color:rgb(34,34,34)"><font size="1">%component at that particular frequency for that particular file</font></div>

<div style="color:rgb(34,34,34)"><font size="1">%you should be able to find the columns in this one row that</font></div><div style="color:rgb(34,34,34)"><font size="1">%represent alpha (try plotting that one row)</font></div>

<div style="color:rgb(34,34,34)"><font size="1">%then take an average of the values in those columns of the one row</font></div><div style="color:rgb(34,34,34)"><font size="1">%and save them out as a new variable or add them to a statistics speadsheet</font></div>

<div style="color:rgb(34,34,34)"><font size="1">%am not sure about getting frequency bands, but the dirty way</font></div><div style="color:rgb(34,34,34)"><font size="1">%would be to simply have run the code for all sub-frequencies of interest</font></div>

<div style="color:rgb(34,34,34)"><font size="1">%and average up from there. Also, apologies, but I can't speak to or</font></div><div style="color:rgb(34,34,34)"><font size="1">%provide caveats about function settings, </font></div>

<div style="color:rgb(34,34,34)"><font size="1">% nor about power vs. amplitude, or using newtimef, or using non-eeglab</font></div><div style="color:rgb(34,34,34)"><font size="1">% computation options. Good luck and let us know </font></div>

<div style="color:rgb(34,34,34)"><font size="1">%what solution ends up working best for you</font></div></div></span>