-
Notifications
You must be signed in to change notification settings - Fork 1
/
instructions.m
52 lines (48 loc) · 1.41 KB
/
instructions.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
escapeKey = KbName('ESCAPE');
spacebar = KbName('space');
leftKey = KbName('LeftArrow');
rightKey = KbName('RightArrow');
activeKeys = [leftKey rightKey escapeKey spacebar];
if DATA.ses == 3
exitKey = escapeKey;
else
exitKey = spacebar;
end
InstrScreens = 0;
% restrict the keys for keyboard input to the keys we want
RestrictKeysForKbCheck(activeKeys);
% suppress echo to the command line for keypresses
% ListenChar(2);
exitInstr = false;
%insMatrix = [instr1, instr2, instr3, instr4, instr5, instr6, instr7, instr8];
insMatrix = [instr1, instr2, instr3, instr4, instr5, instr6, instr7];
n=1;
Screen('DrawTexture', wd, insMatrix(n),[], rect.stim{6});
Screen('Flip', wd);
WaitSecs(0.2);KbWait;
while exitInstr == false
[keyIsDown, secs, keyCode] = KbCheck;
if keyCode(exitKey)
exitInstr = true;
elseif keyCode(leftKey)
n=n-1;
if n < 1
n=1;
end
Screen('DrawTexture', wd, insMatrix(n),[], rect.stim{6});
Screen('Flip', wd);
WaitSecs(0.2);KbWait;
elseif keyCode(rightKey)
n=n+1;
if n < 1
n=1;
elseif n > 7
n = 7;
end
Screen('DrawTexture', wd, insMatrix(n),[], rect.stim{6});
Screen('Flip', wd);
WaitSecs(0.2);KbWait;
end
end
% reset the keyboard input checking for all keys
RestrictKeysForKbCheck ([]);