|
1 | 1 | function responseEvents = getResponse(action, cfg, expParameters, getOnlyPress, verbose) |
2 | 2 | % wrapper function to use KbQueue |
3 | 3 | % 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. |
5 | 7 | % |
6 | | -% INPUT |
7 | 8 | % |
8 | | -% getOnlyPress: will only return the key press and not the releases and not just the key presses. (default=1) |
| 9 | +% |
| 10 | +% INPUT |
9 | 11 | % |
10 | 12 | % - action: Defines what we want the function to do |
11 | 13 | % - init: to initialise the queue |
12 | 14 | % - 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: |
15 | 18 | % |
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 |
20 | 22 | % |
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 | + |
22 | 45 |
|
23 | 46 | if nargin < 4 |
24 | 47 | getOnlyPress = 1; |
|
0 commit comments