Skip to content

Commit f0f3e1c

Browse files
committed
fix help section getResponse
1 parent 2cd37c2 commit f0f3e1c

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

src/keyboard/getResponse.m

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
function responseEvents = getResponse(action, deviceNumber, cfg, getOnlyPress)
44
%
55
% Wrapper function to use KbQueue. The queue will be listening to key presses on a keyboard device:
6-
% ``cfg.keyboard.responseBox`` or ``cfg.keyboard.keyboard`` are 2 main examples.When no deviceNumber
6+
% ``cfg.keyboard.responseBox`` or ``cfg.keyboard.keyboard`` are 2 main examples. When no deviceNumber
77
% is set then it will listen to the default device. Check the ``CPP_getResponseDemo`` for a quick
88
% script on how to use it.
99
%
@@ -19,33 +19,39 @@
1919
% return when the keys were released (default=true). See the section on
2020
% `Returns` below for more info
2121
%
22-
% :returns: - :responseEvents: returns all the keypresses and return them as a structure with
23-
% field names that make it easier to save the output of in a BIDS format
22+
% :returns: - :responseEvents: returns all the keypresses and return them as a structure with field names that make it easier to save the output of in a BIDS format
23+
%
24+
% - ``responseEvents.onset`` this is an absolute value and you should substract the "experiment start time" to get a value relative to when the experiment was started.
25+
%
26+
% - ``responseEvents.trial_type = response``
27+
%
28+
% - ``responseEvents.duration = 0``
29+
%
30+
% - ``responseEvents.keyName`` the name of the key pressed
31+
%
32+
% - ``responseEvents(iEvent,1).pressed`` if
2433
%
25-
% - ``responseEvents.onset``: this is an absolute value and you should substract the
26-
% "experiment start time" to get a value relative to when the
27-
% experiment was started.
28-
% - ``responseEvents.trial_type = response``;
29-
% - ``responseEvents.duration = 0;``
30-
% - ``responseEvents.keyName``: the name of the key pressed
31-
% - ``responseEvents(iEvent,1).pressed``: if
3234
% - pressed == 1 --> the key was pressed
3335
% - pressed == 0 --> the key was released
3436
%
37+
% ---
38+
%
3539
% ``action`` options:
3640
%
37-
% - ``init``: to initialise the queue
38-
% - ``start``: to start listening to keypresses
39-
% - ``check``: checks all the key presses events since 'start', or since last 'check' or 'flush'
40-
% (whichever was the most recent)
41-
% - can check for demand to abort if the escapeKey is listed in the Keys of interest
42-
% - can only check for demands to abort when ``getResponse('check')`` is called so there will be
43-
% a delay between the key press and the experiment stopping
44-
% - abort errors send specific signals that allow the catch to get
45-
% them and allows us to "close" nicely
46-
% - ``flush``: empties the queue of events in case you want to restart from a clean
47-
% queue
48-
% - ``stop``: stops listening to key presses
41+
% - ``init`` to initialise the queue
42+
%
43+
% - ``start`` to start listening to keypresses
44+
%
45+
% - ``check`` checks all the key presses events since 'start', or since last 'check' or 'flush' (whichever was the most recent)
46+
%
47+
% - can check for demand to abort if the ``escapeKey`` is listed in the Keys of interest
48+
% - can only check for demands to abort when ``getResponse('check')`` is called so there will be a delay between the key press and the experiment stopping
49+
% - abort errors send specific signals that allow the catch to get them and allows us to "close" nicely
50+
%
51+
% - ``flush`` empties the queue of events in case you want to restart from a clean queue
52+
%
53+
% - ``stop`` stops listening to key presses
54+
%
4955

5056
if nargin < 2 || isempty(deviceNumber)
5157
deviceNumber = -1;

0 commit comments

Comments
 (0)