<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi I have a silly question,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">How does one use a folder of edf files of subjects to repeat the code below so that I can perform a grand average in the end? Or does each file have to be run seperately
 with seperate codes? </span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Mubeen </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
cfg            = [];
<div>cfg.dataset    = 'C:\Users\mubaf\OneDrive\Desktop\MY BRAINSTORM\Cases GGE\JJ_05-01-2017.edf';</div>
<div>cfg.channel    = {'EEG Fp1' 'EEG Fp2' 'EEG F7' 'EEG F3' 'EEG Fz' 'EEG F4'...</div>
<div>    'EEG F8' 'EEG T7' 'EEG C3' 'EEG Cz' 'EEG T8' 'EEG P7' 'EEG P3' 'EEG C4'...
</div>
<div>    'EEG Pz' 'EEG P4' 'EEG O1' 'EEG O2', 'EEG T3', 'EEG T5', ...</div>
<div>    'EEG T4', 'EEG T6' 'Fp1' 'Fp2' 'F7' 'F3' 'Fz' 'F4' 'F8' 'T7' 'C3'...</div>
<div>    'Cz' 'C4' 'T8' 'P7' 'P3' 'Pz' 'P4' 'O1' 'O2', 'T3', 'T5', 'T4', 'T6'};%'P8'</div>
<div>hdr = ft_read_header(cfg.dataset);</div>
<div>event = ft_read_event(cfg.dataset, 'detectflank', []);</div>
<div><br>
</div>
<div>cfg.trialdef.prestim   = 0.5;                   % in seconds</div>
<div>cfg.trialdef.poststim  = 2.5;     % in seconds</div>
<div>cfg.trialdef.eventtype = 'annotation'</div>
<div>cfg.trialdef.eventvalue = 'Ep.sw'; </div>
<div>cfg = ft_definetrial(cfg);</div>
<div><br>
</div>
<div>datatrials  = ft_preprocessing(cfg);</div>
<div>cfg.continuous              = 'no'</div>
<div>cfg.blocksize  = 10</div>
<div>cfg.channel = 'eeg'</div>
<div>cfg = ft_databrowser(cfg, datatrials)</div>
<div><br>
</div>
<div>%power analysis (calls 1 function)</div>
<div>cfg.method = 'mtmfft'</div>
<div>cfg.output ='pow'</div>
<div>cfg.channel  = 'all';</div>
<div>cfg.trials = 'all'</div>
<div>cfg.keeptrials = 'yes' %all trials powerspectrum available if yes in freq.powspctrm</div>
<div>cfg.keeptapers = 'no'</div>
<div>cfg.pad = 'maxperlen'</div>
<div>cfg.polyremoval = 0 %(0 demeans only/1 demeans and detrends/-1 no removal)</div>
<div>cfg.taper = 'hann'</div>
<div>cfg.foilim = [2 50]</div>
<div>freq = ft_freqanalysis(cfg, datatrials);</div>
<div><br>
</div>
<div>cfg.variance      = 'yes' </div>
<div>cfg.jackknife     = 'no'</div>
<div>cfg.keeptrials    = 'yes' </div>
<div>cfg.channel       = 'all'</div>
<div>cfg.trials        = 'all' </div>
<div>cfg.frequency     = [2 50] </div>
<div>cfg.latency       = 'all'</div>
<div>[descrip] = ft_freqdescriptives(cfg, freq)</div>
<div><br>
</div>
<div><br>
</div>
</div>
</body>
</html>