[Eeglablist] FW: About an export of mean band power etc
Tarik S Bel-Bahar
tarikbelbahar at gmail.com
Sun Feb 26 21:37:43 PST 2012
Hi Guy, due to your time urgency, and current level of awareness of eeglab
and matlab,
perhaps the following code derived for your situation may help. Do let us
know of your final solution please.
This solution uses spectopo to compute info for a specific component at a
specific frequency for a series of files, components, and frequencies.
See annotations for what to change or modify. You should end up with unique
and easily addressable variables
in your workspace, one for each "file, component, and frequency
combination".
Averaging and computing scores within and across participants I leave to
you. Check the brief notes in the code.
Best wishes, Tarik
[just paste the below to your matlab editor, modify, and give it a go] [if
there is a hiccup when attempting to run, let me know].
*************************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','currenfilename','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([v
' = 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/20120226/07b687cf/attachment.html>
More information about the eeglablist
mailing list