-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprep_all.m
36 lines (34 loc) · 1.31 KB
/
prep_all.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
25
26
27
28
29
30
31
32
33
34
35
36
% Batch convert Pitt data
% Usage:
% Set `root_dir` below
% Open matlab shell and add rtma/climber to path (or e.g. init in a dir with appropriate startup.m)
% cd to this working dir (so that prep_all is available)
% Call prep_all
function prep_all(subject)
% Prepares all experiment data for a given subject.
% Example usage:
% prep_all('P4_14')
%
% Parameters:
% subject (string): The subject identifier to filter experiment data on.
% For example, 'P4' for subject 'P4'.
%
% Returns:
% None
root_dir = char(pwd);
root_dir = fullfile(root_dir, "data/pitt_misc/");
% root_dir = "/home/joelye/projects/context_general_bci/data/pitt_misc/";
experiments = dir(root_dir);
subject_id = strcat(subject, '_');
for experiment = experiments'
if startsWith(experiment.name, subject_id)
experiment = experiment.name
disp(experiment)
prefix = "QL.";
experiment_dir = fullfile(root_dir, experiment);
ql_files = dir(fullfile(experiment_dir,strcat(prefix, '*.bin')));
target_dir = fullfile(root_dir, "mat", experiment)
names = arrayfun(@(x) x.name, ql_files, 'UniformOutput', false);
prep_multiple(root_dir, experiment, names)
end
end