-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadinsubjid.m
More file actions
31 lines (27 loc) · 873 Bytes
/
readinsubjid.m
File metadata and controls
31 lines (27 loc) · 873 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
30
31
function [ status, subjectid ] = readinsubjid( )
%readinsubjid Summary of this function goes here
% Detailed explanation goes here
prompt = {'Enter participant number (starting from 1000)'};
dlg_title = 'Welcome';
def = {'1000'};
answer = inputdlg(prompt, dlg_title, 1, def);
% Print to command line when cancel by user
% and exit
if isempty(answer)
fprintf('Session cancelled by user\n')
subjectid = [];
status = 1;
else
% read in subject id
subjectid = answer{1};
% check whether entry is correct
if ~(str2double(subjectid) >= 1000 && str2double(subjectid) <= 1999)
status = 1;
subjectid = [];
fprintf('Wrong entry\n')
fprintf('Subject number has to be between 1000 and 1999\n')
return
end
status = 0;
end
end