[Eeglablist] FW: About an export of mean band power etc

Tarik S Bel-Bahar tarikbelbahar at gmail.com
Mon Feb 27 18:40:07 PST 2012


two corrections for eeglab list posting, below in red

*************************BEGIN SAMPLE CODE


%this should run on epoched and unepoched files
%I did not modify settings further, nor examine function specifications

clear
clc
eeglab
cd ( '/Homedirectory/DirectoryNameYouwantTouseThatHasTheFiles/');
%directory should already exist and have all EEGLAB files
filepath = pwd; %makes filepath the same as the directory with the files
%here you set up your lists of components, files, and frequencies to loop
through
myListofComponents = [1,2,3,4,5];
myListofFiles = ['file1.set','file2.set','file3.set'];
myListOfFrequencies = [5,10,20]
percentageofFiletoAnalyze = 2;
for LoopThroughFiles = 1: length(myListofFiles)
    %begin file loop
currentfilename = myListofFiles(LoopThroughFiles);
EEG = pop_loadset('filename',*currentfilename*,'filepath',currentfilepath);
[ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 1 );
 for LoopThroughComponents = 1: length(myListofComponents)
     %begin component loop
currentcompA = myListofComponents(LoopThroughComponents);
%set number of component of interest in current single subject single
session file
for LoopThroughFrequencies = 1: length(myListofFrequencies)
    %begin frequency loop
currentfrequency = myListOfFrequencies(LoopThroughComponents);
% set current frequency of interest
figure;  [spectra freqs speccomp] = pop_spectopo(EEG, 0, [0      EEG.xmax
*1000], 'EEG' ...
 , 'freq', [currentfrequency], 'plotchan', 0, 'percent',
percentageofFiletoAnalyze, 'icacomps', [currentcompA]...
, 'nicamaps', 1, 'icamaps', [1], 'icamode',  'normal',  'freqrange',[8
12],'electrodes','off'); close(gcf);
%ignore figure I could not manage to turn it off
%freqs returns a column of numbers (freqs1),  %freqs(2), etc.... which
specify the Hz for %each column in speccomp
newspecs=speccomp;newfreqs=freqs; %dump output to dummy holding variables
currentfilename1=currentfilename(1:5); %take first n characters of each
filename
currentcompA1= num2str(currentcompA);
 v = genvarname([ 'speccomp' currentfilename1 currentcompA1 'hz']); eval([v
' = newspecs']);
v2 = genvarname([ 'speccomp' currentfilename1 currentcompA1 'hz']); eval([*
v2* ' = newfreqs']);
end %end frequency loop
end %end component loop
end %end file loop

%NOTES TO GUY
%the above should provide a file in the workspace named [FileName_Component
Number_ Frequency]
%the top row of each "speccompfileXhz" file contains the output for that
%component at that particular frequency for that particular file
%you should be able to find the columns in this one row that
%represent alpha (try plotting that one row)
%then take an average of the values in those columns of the one row
%and save them out as a new variable or add them to a statistics speadsheet
%am not sure about getting frequency bands, but the dirty way
%would be to simply have run the code for all sub-frequencies of interest
%and average up from there. Also, apologies, but I can't speak to or
%provide caveats about function settings,
% nor about power vs. amplitude, or using newtimef, or using non-eeglab
% computation options. Good luck and let us know
%what solution ends up working best for you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20120227/447e163f/attachment.html>


More information about the eeglablist mailing list