[Eeglablist] How to get the largest-contributing components at a specified frequency manually

nastaran.takmil at st.ovgu.de nastaran.takmil at st.ovgu.de
Thu Mar 26 10:10:20 PDT 2020


Hello everyone,
In order to get the largest-contributing components at a specified  
frequency, I followed this path:
eeglab->Plot->Component spectra and maps

I got the plot of the largest-contributing components (I have attached  
the figure) and also all components percent relative variance at the  
chosen frequency were printed on the command window.
Since I want to do the same thing for many participants, I was  
thinking of writing a code which can give me the components percent  
relative variance at a specified frequency as an output.
I tried to use the main eeglab codes such as pop_spectopo and spectopo  
to understand how to get those components percent relative variance as  
a separate output but what I can see in the output generation part of  
pop_spectopo.m is:

% plot the data and generate output and history commands
% ------------------------------------------------------
popcom = sprintf('figure; pop_spectopo(%s, %d, [%s], ''%s'' %s);',  
inputname(1), dataflag, num2str(timerange), processflag, options);
switch processflag
	case { 'EEG' 'eeg' }, SIGTMP = reshape(SIGTMP, size(SIGTMP,1),  
size(SIGTMP,2)*size(SIGTMP,3));
	        com = sprintf('%s spectopo( SIGTMP, totsiz, EEG.srate %s);',  
outstr, spectopooptions);
                 eval(com)
        case { 'ERP' 'erp' },
                 com = sprintf('%s spectopo( mean(SIGTMP,3), totsiz,  
EEG.srate %s);', outstr,spectopooptions);
                 eval(com)
        case { 'BOTH' 'both' }, sbplot(2,1,1); com = sprintf('%s  
spectopo( mean(SIGTMP,3), totsiz,EEG.srate,''title'',''ERP'' %s);',  
outstr, spectopooptions);
                 eval(com)
	        SIGTMP = reshape(SIGTMP, size(SIGTMP,1),  
size(SIGTMP,2)*size(SIGTMP,3));
	        sbplot(2,1,2); com = sprintf('%s spectopo( SIGTMP, totsiz,  
EEG.srate, ''title'', ''EEG'' %s);', outstr, spectopooptions); eval(com)
end;

if nargout < 2 & nargin < 3
	varargout{1} = popcom;
end;
I don't know how the get output out of the strings printing the  
results! Has anyone tried coding like this before?
Could you please help me in sorting this out?
Nastaran





More information about the eeglablist mailing list