Skip to content

Commit ae37cb6

Browse files
committed
clean getResponse
1 parent 252f20e commit ae37cb6

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

CPP_getResponseDemo.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
eventType = 'released';
111111
end
112112

113-
fprintf('%s was %s at time %.3f seconds\n', ...
113+
fprintf('\n%s was %s at time %.3f seconds\n', ...
114114
responseEvents(iEvent).key_name, ...
115115
eventType, ...
116116
responseEvents(iEvent).onset - startSecs);

getResponse.m

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
% - flush:
1717
% - stop:
1818
%
19-
% - getOnlyPress: if set to 1 the function will only return the key presses and
20-
% will not return when the keys were released (default=1)
19+
% - getOnlyPress: if set to true the function will only return the key presses and
20+
% will not return when the keys were released (default=true)
2121
% See the section on OUTPUT below for more info
2222
%
2323
%
@@ -44,24 +44,19 @@
4444

4545

4646
if nargin < 4
47-
getOnlyPress = 1;
47+
getOnlyPress = true;
4848
end
4949

5050
responseEvents = struct;
51-
responseEvents.onset = [];
52-
responseEvents.trial_type = [];
53-
responseEvents.duration = [];
54-
responseEvents.key_name = [];
55-
responseEvents.pressed = [];
5651

5752
responseBox = cfg.responseBox;
5853

5954
switch action
6055

6156
case 'init'
6257

63-
% Prevent spilling of keystrokes into console. If you use ListenChar(2)
64-
% this will prevent you from using KbQueue.
58+
% Prevent spilling of keystrokes into console.
59+
% If you use ListenChar(2), this will prevent you from using KbQueue.
6560
ListenChar(-1);
6661

6762
% Clean and realease any queue that might be opened
@@ -138,6 +133,7 @@ function talkToMe(action, expParameters)
138133

139134
end
140135

136+
141137
function keysOfInterest = setKeysOfInterest(expParameters)
142138
% list all the response keys we want KbQueue to listen to
143139
% by default we listen to all keys

0 commit comments

Comments
 (0)