|
2 | 2 |
|
3 | 3 | function responseEvents = getResponse(action, deviceNumber, cfg, getOnlyPress) |
4 | 4 | % |
5 | | - % 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 |
7 | | - % is set then it will listen to the default device. Check the ``CPP_getResponseDemo`` for a quick |
8 | | - % script on how to use it. |
| 5 | + % Wrapper function to use KbQueue. The queue will be listening to key presses |
| 6 | + % on a keyboard device: |
| 7 | + % ``cfg.keyboard.responseBox`` or ``cfg.keyboard.keyboard`` are 2 main examples. |
| 8 | + % When no ``deviceNumber`` is set then it will listen to the default device. |
| 9 | + % Check the ``CPP_getResponseDemo`` for a quick script on how to use it. |
9 | 10 | % |
10 | | - % USAGE: |
| 11 | + % USAGE:: |
11 | 12 | % |
12 | 13 | % responseEvents = getResponse(action, deviceNumber, cfg, getOnlyPress) |
13 | 14 | % |
|
19 | 20 | % return when the keys were released (default=true). See the section on |
20 | 21 | % `Returns` below for more info |
21 | 22 | % |
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 | + % :returns: |
23 | 24 | % |
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 | + % - :responseEvents: returns all the keypresses and return them |
| 26 | + % as a structure with field names that make it easier |
| 27 | + % to save the output of in a BIDS format |
25 | 28 | % |
26 | | - % - ``responseEvents.trial_type = response`` |
| 29 | + % - ``responseEvents.onset`` this is an absolute value and you should substract |
| 30 | + % the "experiment start time" to get a value relative to when the experiment was started. |
27 | 31 | % |
28 | | - % - ``responseEvents.duration = 0`` |
| 32 | + % - ``responseEvents.trial_type = response`` |
29 | 33 | % |
30 | | - % - ``responseEvents.keyName`` the name of the key pressed |
| 34 | + % - ``responseEvents.duration = 0`` |
31 | 35 | % |
32 | | - % - ``responseEvents(iEvent,1).pressed`` if |
| 36 | + % - ``responseEvents.keyName`` the name of the key pressed |
33 | 37 | % |
34 | | - % - pressed == 1 --> the key was pressed |
35 | | - % - pressed == 0 --> the key was released |
| 38 | + % - ``responseEvents(iEvent,1).pressed`` if |
| 39 | + % |
| 40 | + % - ``pressed == 1`` --> the key was pressed |
| 41 | + % - ``pressed == 0`` --> the key was released |
36 | 42 | % |
37 | 43 | % --- |
38 | 44 | % |
|
42 | 48 | % |
43 | 49 | % - ``start`` to start listening to keypresses |
44 | 50 | % |
45 | | - % - ``check`` checks all the key presses events since 'start', or since last 'check' or 'flush' (whichever was the most recent) |
| 51 | + % - ``check`` checks all the key presses events since 'start', or since last 'check' |
| 52 | + % or 'flush' (whichever was the most recent) |
| 53 | + % |
| 54 | + % - can check for demand to abort if the ``escapeKey`` is listed in the Keys of interest |
| 55 | + % |
| 56 | + % - can only check for demands to abort when ``getResponse('check')`` is called |
| 57 | + % so there will be a delay between the key press and the experiment stopping |
46 | 58 | % |
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 |
| 59 | + % - abort errors send specific signals that allow the catch to get them and allows us |
| 60 | + % to "close" nicely |
50 | 61 | % |
51 | 62 | % - ``flush`` empties the queue of events in case you want to restart from a clean queue |
52 | 63 | % |
|
0 commit comments