[Eeglablist] Separate power indices for each ERP dataset in a for loop

VARMA, MOHITH MUKUND mohith96 at connect.hku.hk
Fri Jan 18 21:51:04 PST 2019

Dear all,

I am trying to derive the absolute power indices and its derivatives (e.g.
mean and SD and graphs that show the power spectra) from each participants'
epoched datasets. I have epoched the continuous EEG based on the
participants sleep stage and I run multiple for loops to process my data.
However, in the current code, MATLAB summates the value from each
participant and across each of the epoched datasets. Instead I would like
to obtain separate indices for each epoched dataset within each participant
so that later I can run some within subject analysis on this data.
Following is the code that I have compiled so far:
%Step Five: This will load in sleep stage and run spectral analysis for
each sleep stage within
%each participant.

subject_list = {'304'};

Fs = 250;

stage_list = {'N1','N2','N3','REM'};

numsubjects  = length(subject_list); % number of subjects

numstage = length(stage_list); % number of sleep stages

parentfolder = 'C:/Users/user/Documents/psg_data/';

for s=1:numsubjects

    subject = subject_list{s};

    fprintf('\n\n\n*** Processing subject %d (%s) ***\n\n\n', s, subject);

    for j=1:numstage

        stages = stage_list{j};

        EEG = pop_loadset([subject '_' stages '.set']);

        p = pwelch(EEG.data(4,:),[],[],[],Fs,'onesided');

        [ALLEEG EEG CURRENTSET] = eeg_store( ALLEEG, EEG, 0 );

        EEG.setname = [subject '_' stages];

        EEG = eeg_checkset( EEG );



eeglab redraw

Your help in debugging this problem is very much appreciated. Thanks in


Mohith M. Varma (Mo)
Graduate Research Assistant

Social & Cognitive Neuroscience Laboratory
Department of Psychology
Faculty of Social Sciences
The University of Hong Kong
Tel: (+852) 52622875
Email: mohith96 at connect.hku.hk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20190119/e16ad592/attachment.html>

More information about the eeglablist mailing list