Hi Mario,
This follows my previous query, which was unilaterally closed. By “looking to allocate” means the approval has to go through my supervisor and through the university finance department. My token number is JTKTU2AV-202322110417:059b4e141afb382956cd2ecd8e0f1c23f06b58088ede94174ffe9a41f7e09387
Now to the problem. I’m don’t use ListenChar or GetChar at any point during my code. To recap, I’m having the following error when calling “KbQueueStart”:
Keyboard queue for device NaN already in use by GetChar() et al. Use of GetChar and keyboard queues is mutually exclusive!
My design is an adaptation of the classical RSVP paradigm. Participant information is gathered at the beginning of the experiment on a dialog box (using inputdlg, in case that’s of any relevance). The design is as follows: I first present 7 rapidly displayed stimuli (50 ms +150 ms blank) and it is followed by a 200 ms search display. After a 150 ms blank, the experiment automatically moves to the next trial. Therefore, participant response for trial i is collected on trial i+1.
Here what I believe are the important parts of the code:
%% Initialize block
for block = 1:t_params.n_block
%% Initialize trial
PsychHID('KbQueueCreate');
KbQueueReserve(1,2,[]); % I was using both PsychHID and KbQueueReserve to get through the error explained above, but it seems not to be working now.
FlushEvents('keyDown');
%% Start trial loop
for trial = 1:t_params.n_trial
%% Present 7 stimuli before Search display
for stimuli = 1:t_params.n_stimuli
%Here I do the drawing and flips
%% Collect the response (for trial-1)
while trial>0 % Response collection starts during trial 2 (for trial 1), so I skip response check on trial 1
if trial==1
break;
else % Check response
KbQueueStop(); % Stop keyboard monitoring for response, just after (trial+1) search onset
[pressed,firstPress] = KbQueueCheck();
% I collect the response data here
%% Save trial data
% Here I save the trial data, I need to know which key was pressed to compute accuracy
end
break;
end
%% Present the search display
%More drawing here
%% Start keyboard monitoring for response (just after search offset)
KbQueueStart();
KbQueueFlush();
%%It goes back to the beginning of the loop, unless it is the last trial. Each block ends with the presentation of the 7 shortly presented stimuli
if trial==t_params.n_trial % In the last trial of the block, I collect the response after search display
%% Present last 7 stimuli
%% Collect response for the last trial (trial ==12)
KbQueueStop(); % Stop keyboard monitoring for response
trial=trial+1; % This will be now trial 13, otherwise we would overwrite the response collected in trial 12 (which belongs to trial 11)
[pressed,firstPress] = KbQueueCheck();
% Collect the response data
end
end %% Block ends
This is the design. The code crashes when it gets to KbQueueStart().
I’m using Windows 10, Matlab 2022b and Psychtoolbox 3.0.18.
Thanks.