[Eeglablist] Separate power indices for each ERP dataset in a for loop
Makoto Miyakoshi
mmiyakoshi at ucsd.edu
Mon Jan 21 13:20:54 PST 2019
Dear Mohith,
Instead of
p = pwelch(EEG.data(4,:),[],[],[],Fs,'onesided');
Use
p(j,:) = pwelch(EEG.data(4,:),[],[],[],Fs,'onesided');
If the length of the output changes,
p{j} = pwelch(EEG.data(4,:),[],[],[],Fs,'onesided');
Makoto
On Mon, Jan 21, 2019 at 9:04 AM VARMA, MOHITH MUKUND <
mohith96 at connect.hku.hk> wrote:
> 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.
>
> clear;
> eeglab
> 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 );
>
> end;
>
> end;
>
> eeglab redraw
>
> Your help in debugging this problem is very much appreciated. Thanks in
> advance.
>
> Regards,
>
> --
> 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
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
--
Makoto Miyakoshi
Swartz Center for Computational Neuroscience
Institute for Neural Computation, University of California San Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20190121/88a4952d/attachment.html>
More information about the eeglablist
mailing list