-
Notifications
You must be signed in to change notification settings - Fork 1
/
rateConf.m
49 lines (37 loc) · 1.27 KB
/
rateConf.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
function [rating]= rateConf()
% RATECONF rate confidence by controlling the size and color of a circle.
% Matan Mazor, 2018
global params
global w
increase_key =KbName('UpArrow');
decrease_key = KbName('DownArrow');
timer = tic();
% initial confidence rating is determined randomly
rating = randperm(6,1);
new_rating = rating;
while toc(timer)<params.time_to_conf
% draw scale
Screen('DrawLine', w ,[255,255,255], params.center(1),...
params.center(2)-200, params.center(1), params.center(2)+200 ,2);
for i_t=1:6
tic_height = params.center(2)-200+(i_t-1)*400/5;
Screen('DrawLine', w ,[255,255,255], params.center(1)-2,...
tic_height, params.center(1)+2, tic_height ,1);
end
%draw dot
Screen('DrawDots', w, [0 200-(rating-1)*80]', ...
10, [255 255 255], params.center,1);
vbl=Screen('Flip', w);
keysPressed = queryInput();
if keysPressed(decrease_key)
new_rating=max(1,rating-1);
elseif keysPressed(increase_key)
new_rating=min(6,rating+1);
elseif ~keysPressed %update rating only when key is released
rating = new_rating;
end
end
% present the chosen confidence for 100 milliseconds
while toc(timer)<params.time_to_conf+0.1
keysPressed = queryInput();
end