-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextract_baseline_epoch.m
24 lines (23 loc) · 1.05 KB
/
extract_baseline_epoch.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function extract_baseline_epoch(PATHIN,PATHOUT,pretime,postime,extract_events)
% input:
% 渦
θ러孃竊?PATHIN
% 渦븃러孃竊?PATHOUT
% extract_events={ 'S 1' 'S 2' 'S 3' }
cd(PATHIN)
list=dir('*.set');
len=length(list);
[ALLEEG EEG CURRENTSET ALLCOM] = eeglab;
for s=1:len
EEG = pop_loadset('filename',[num2str(s),'.set'],'filepath',PATHIN);
[ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 0 );
EEG = eeg_checkset( EEG );
EEG = pop_epoch( EEG,extract_events, [pretime postime], 'newname', 'EEG_data pruned with ICA pruned with ICA epochs', 'epochinfo', 'yes');
[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 1,'gui','off');
EEG = eeg_checkset( EEG );
EEG = pop_rmbase( EEG, [pretime*1000 0]);
[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, 2,'gui','off');
EEG = eeg_checkset( EEG );
EEG = pop_saveset( EEG, 'filename',[num2str(s),'.set'],'filepath',PATHOUT);
[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);
STUDY = []; CURRENTSTUDY = 0; ALLEEG = []; EEG=[]; CURRENTSET=[];
end