Skip to content

Commit ec00b44

Browse files
committed
improve help section getResponse
1 parent 0d72b1a commit ec00b44

File tree

1 file changed

+33
-10
lines changed

1 file changed

+33
-10
lines changed

Visual-loc_translational/subfun/CPP_PTB/getResponse.m

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,47 @@
11
function responseEvents = getResponse(action, cfg, expParameters, getOnlyPress, verbose)
22
% wrapper function to use KbQueue
33
% The queue will be listening to key presses on the response box as defined
4-
% in the cfg structure : see setParameters for more details
4+
% in the cfg structure : see setParameters for more details.
5+
%
6+
% Check the CPP_getResponseDemo for a quick script on how to use it.
57
%
6-
% INPUT
78
%
8-
% getOnlyPress: will only return the key press and not the releases and not just the key presses. (default=1)
9+
%
10+
% INPUT
911
%
1012
% - action: Defines what we want the function to do
1113
% - init: to initialise the queue
1214
% - start: to start listening to keypresses
13-
%
14-
% Get all the keypresses and return them as an array responseEvents
15+
% - check:
16+
% - flush:
17+
% - stop:
1518
%
16-
% Time Keycode Pressed
17-
%
18-
% Pressed == 1 --> the key was pressed
19-
% Pressed == 0 --> the key was released
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)
21+
% See the section on OUTPUT below for more info
2022
%
21-
% KbName(responseEvents(:,2)) will give all the keys pressed
23+
%
24+
%
25+
% OUTPUT
26+
%
27+
% responseEvents: returns all the keypresses and return them as a structure
28+
% with field names that make it easier to save the output of in a BIDS
29+
% format
30+
%
31+
% responseEvents.onset : this is an absolute value and you should
32+
% substract the "experiment start time" to get a value relative to when the
33+
% experiment was started.
34+
%
35+
% responseEvents.trial_type = 'response';
36+
%
37+
% responseEvents.duration = 0;
38+
%
39+
% responseEvents.key_name : the name of the key pressed
40+
%
41+
% responseEvents(iEvent,1).pressed : if
42+
% pressed == 1 --> the key was pressed
43+
% pressed == 0 --> the key was released
44+
2245

2346
if nargin < 4
2447
getOnlyPress = 1;

0 commit comments

Comments
 (0)