forked from Temporo-spatial/IntrinsicNeuralTimescales-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloop_ICA.m
More file actions
39 lines (19 loc) · 733 Bytes
/
loop_ICA.m
File metadata and controls
39 lines (19 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
%loop for running ICA on the already preprocessed resting state files
eeglab
directory_name = uigetdir;
cd(directory_name);
files = dir(fullfile(directory_name, '*.set'));
fileindex = find(~[files.isdir]);
%%%%Loop through all the files
for i = 1:length(fileindex)
filename = files(fileindex(i)).name;
[PATH, NAME, EXT] = fileparts(filename);
NAME = [NAME, EXT];
EEG = pop_loadset( 'filename', filename, 'filepath', directory_name);
% Downsample to 250Hz
% EEG = pop_resample(EEG, 250);
EEG = pop_runica(EEG, 'interupt','on');
EEG = eeg_checkset( EEG );
EEG = pop_saveset( EEG, 'filename',[filename, '_ICA.set'],'filepath',[directory_name '/ICA']);
EEG = eeg_checkset( EEG );
end;