-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollectParticipantInfo.m
69 lines (36 loc) · 1.36 KB
/
collectParticipantInfo.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function collectParticipantInfo(ptpntCode)
%collect participant information and save it to file
% First check we will not be overwritting any files when we save later
filename = (['ptpnt' num2str(ptpntCode) '_anon']);
if exist([pwd '/Data/' filename '.mat']) == 2; error('Ptpnt num already exists'); end
% Create a figure to cover the back of the screen
figure
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Collect age
invalidResponse = 1;
while invalidResponse ~= 0
% Present dialog box
ageReport = inputdlg({'What is your age?'});
Anon.Age = ageReport{1};
%check the response is one of the response options
invalidResponse = sum(~isstrprop(Anon.Age, 'digit'));
if invalidResponse == 0 && str2num(Anon.Age) < 18
invalidResponse = 1;
end
end
% Collect hand
Anon.Hand = '';
while strcmp(Anon.Hand , '')
Anon.Hand = questdlg('Which is your dominant hand?',...
'Q2', 'Left', 'Right', 'Neither', 'Neither');
end
% Collect gender
Anon.Gender = [];
while isempty(Anon.Gender)
options = {'Female', 'Male', 'Non-binary', 'Prefer not to say'};
Anon.Gender = listdlg('PromptString', 'What is your gender identity?', ...
'SelectionMode','single', 'ListString', options);
end
%save data
save([pwd '/Data/' filename], 'Anon');
close all