keyboard stimulator
Posted: Mon Aug 02, 2021 2:52 pm
Hi,
I've exhausted own troubleshooting ideas and would hugely appreciate insights on why I'm experiencing the issue described below. If it helps, I uploaded the relevant openvibe scenario: keyboard stimulator + MATLAB scripting box, and corresponding MATLAB-BOX SCRIPTS on WeTransfer: https://we.tl/t-t7UCui4s7M.
My MATLAB box brings up the window (Psychotoolbox Screen) on monitor #2 with some instructions and the idea is to replace them with a fixation cross after the 'a' key was pressed. I followed MATLAB tutorial #1 (http://openvibe.inria.fr/tutorial-using ... -openvibe/) and I use the default key specs in the shared openvibe file 'simple-keyboard-to-stimulations.txt'. The problem seems to be in line 56 of the MATLAB SCRIPT 'RunExpBlock_process' i.e. in this command: [box_in,starttime,endtime,keypress] = OV_popInputBuffer(box_in,2). The keypress variable is always empty, even when I press all keys on the keyboard one by one.
Here is an extract of the script:
%% keyboard
if box_in.user_data.is_headerset>0
save bo % works ok, MATLAB saves 'bo' (variables in the workspace)
[box_in,starttime,endtime,keypress] = OV_popInputBuffer(box_in,1);
if ~isempty(keypress)
save boo % boo never saved despite regardless of how long I keep pressing 'a' or other keys - the keypress is always empty!
if any(keypress(:,1)==33025)
% want to press 'a' to begin (fixation cross should replace instructions)
Screen('TextSize', box_in.user_data.w, 52);
DrawFormattedText(box_in.user_data.w, '+',...
'center', 'center', BlackIndex(box_in.user_data.w));
Screen('Flip',box_in.user_data.w);
save booo
CRASH % this never happened (because of empty keypress variable)
end
end
end
My experiment runs on Windows 10, Matlab version is 2020, 2 monitors.
Thanks in advance for help!
Renata
I've exhausted own troubleshooting ideas and would hugely appreciate insights on why I'm experiencing the issue described below. If it helps, I uploaded the relevant openvibe scenario: keyboard stimulator + MATLAB scripting box, and corresponding MATLAB-BOX SCRIPTS on WeTransfer: https://we.tl/t-t7UCui4s7M.
My MATLAB box brings up the window (Psychotoolbox Screen) on monitor #2 with some instructions and the idea is to replace them with a fixation cross after the 'a' key was pressed. I followed MATLAB tutorial #1 (http://openvibe.inria.fr/tutorial-using ... -openvibe/) and I use the default key specs in the shared openvibe file 'simple-keyboard-to-stimulations.txt'. The problem seems to be in line 56 of the MATLAB SCRIPT 'RunExpBlock_process' i.e. in this command: [box_in,starttime,endtime,keypress] = OV_popInputBuffer(box_in,2). The keypress variable is always empty, even when I press all keys on the keyboard one by one.
Here is an extract of the script:
%% keyboard
if box_in.user_data.is_headerset>0
save bo % works ok, MATLAB saves 'bo' (variables in the workspace)
[box_in,starttime,endtime,keypress] = OV_popInputBuffer(box_in,1);
if ~isempty(keypress)
save boo % boo never saved despite regardless of how long I keep pressing 'a' or other keys - the keypress is always empty!
if any(keypress(:,1)==33025)
% want to press 'a' to begin (fixation cross should replace instructions)
Screen('TextSize', box_in.user_data.w, 52);
DrawFormattedText(box_in.user_data.w, '+',...
'center', 'center', BlackIndex(box_in.user_data.w));
Screen('Flip',box_in.user_data.w);
save booo
CRASH % this never happened (because of empty keypress variable)
end
end
end
My experiment runs on Windows 10, Matlab version is 2020, 2 monitors.
Thanks in advance for help!
Renata