Install Powermate Controllers
Instead of using the keyboard, the powermate knob can be used. For example, the knob can be turned left or right to adjust the bar orientation in Serial_Dependence_Gabor.m
Download the current software (and manual, if you want) here.
After the powermate software is installed, change the settings to those shown in the image below. Settings on a mac are located in system preferences.
Here is example code that shows how to read the mouse position in MATLAB.
SetMouse(screenRect(3)/2, screenRect(4)/2, w); %start with cursor in the center of the screen
last_mouse_x = GetMouse(w);
[mouse_x,~,buttons] = GetMouse(w);
if mouse_x ~= last_mouse_x
bar_orient = bar_orient + (mouse_x - last_mouse_x);
last_mouse_x = mouse_x;
%draw bar in new orientation
Screen('DrawTexture', w, bartex, gabor_srcRect, gabor_rect, bar_orient);
Screen('DrawTexture', w, masktex, gabor_srcRect, gabor_rect, bar_orient);
Screen('FillOval', w, white, fix_rect); %fixation dot
You can copy and paste the above code into MATLAB or download this code in a text document here.