-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyWrapper.m
More file actions
49 lines (44 loc) · 1.39 KB
/
Copy pathMyWrapper.m
File metadata and controls
49 lines (44 loc) · 1.39 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
%% MyWrapper - A simple wrapper of MyStartServerDT_HCP_Simple_00.m
%
% Note: You should comment out the `dirs = ...` line and use the `dirs = dir(in_dir)` line.
function diaryFile = MyWrapper(n, out_dir, in_dir)
if nargin < 1
n = 10;
end
if nargin < 2
out_dir = 'GSR3_NoFIX'
end
if nargin < 3
in_dir = '/net/10.27.136.121/hcpdb/packages/unzip/HCP_1200/'
end
addpath('MINDyRestTask');
% Get unprocessed subjects
dirs = dir(in_dir); % You should use this one
% dirs = dir(fullfile(out_dir, 'Out')); % I copied the rfMRI preproc results here so as to skip those without rfMRI
allSubs = cellstr({dirs(3:end-1).name});
if isfile('SubList.out')
processedSubs = cellstr(readlines('SubList.out'));
else
processedSubs = {};
end
subs = setdiff(allSubs, processedSubs);
if isempty(subs)
disp('All subjects have been processed.')
return;
end
subs = subs(1:min(n, length(subs)));
diaryFile = sprintf('diary_%s.out', datetime('now', 'Format', 'yyyy-MM-dd_HH-mm-ss'));
diary(diaryFile);
t1 = tic;
disp(subs)
MyStartServerDT_HCP_Simple_00(subs, out_dir, in_dir);
disp('Elapsed time for all subjects:')
toc(t1);
% Save processed subjects
fid = fopen('SubList.out', 'a');
for i = 1:length(subs)
fprintf(fid, '%s\n', subs{i});
end
fclose(fid);
diary off;
end