-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_header.m
41 lines (35 loc) · 1.28 KB
/
init_header.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
37
38
39
40
41
function header = init_header(experiment, subj_info)
%INIT_HEADER Initialize header information for an experiment.
%
% header = init_header(experiment, subj_info)
header = struct();
header.experiment = experiment;
header.date = datestr(now);
header.setuptime = fix(clock);
if nargin == 2 && ~isempty(subj_info)
header.subj_number = subj_info{1};
header.subj_age = subj_info{2};
header.subj_gender = subj_info{3};
return
end
correct = false;
while ~correct
fprintf('\nSubject Information\n-------------------\n');
header.subj_number = input('Subject number: ');
header.subj_age = input('Subject age: ');
header.subj_gender = input('Is this male (1) or female (2)? ');
fprintf('\n');
disp('---------------------------------------------');
disp('Please make sure this information is correct.');
disp('---------------------------------------------');
disp(['Subject number: ', num2str(header.subj_number)]);
disp(['Subject age: ', num2str(header.subj_age)]);
gender = {'male' 'female'};
disp(['Subject gender: ', gender{header.subj_gender}]);
disp('---------------------------------------------');
disp('')
yn = input('Is this correct? (y,n): ', 's');
if isequal(upper(yn(1)), 'Y')
correct = true;
end
end