How to take response from mouse

Below is my code. I have designed a experiment in MATLAB using psychtoolbox where I am presenting ovals for random duration (50ms and 350 ms). After the ovals are being presented, there is question asked to the participant - Whether the presented oval is short (50ms) or long (350ms)? Subjects need to respond via mouse. If the subject feels that it is SHORT they have to click left mouse button and if the subject feels LONG , then they have to click right mouse button . I will be attaching two mouse (one on the left and one on the right sides of computer screen). Right hand dominant person will be responding with the right side mouse and vice versa. Please help me regarding HOW TO COLLECT RESPONSES VIA MOUSE . I am completely out of clue how to do this. I am not getting how to use GetMouse or GetClick function even after reading the help section. I don’t know how to use any function. If possible please help me out regarding this. I would be highly grateful to you. Thanks in advance.


% Clear the workspace and the screen
Screen(‘Preference’, ‘SkipSyncTests’, 1);
close all;


%%%%%%%%%%Creating Variables %%%%%%

Trial_Number = (1:20); % Serial Number of trials

% Delay_time is a variable that will take up random values among (0.05, AND 0.35s- 2 random duration values)
Delay_time = zeros(1,20);
Delay_time (1:10) = 0.05;
Delay_time (11:20) = 0.35;
Delay_time = Delay_time (randperm(20))*1;

%%%%%%%%%%%%%%%%%%%%%%%% Display Oval on PTB screen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Here we call some default settings for setting up Psychtoolbox

% Get the screen numbers
screens = Screen(‘Screens’);

% Draw to the external screen if avaliable
screenNumber = max(screens);

% Define black and white
white = WhiteIndex(screenNumber);
black = BlackIndex(screenNumber);

% Open an on screen window
[window, windowRect] = PsychImaging(‘OpenWindow’, screenNumber, black);

% Get the size of the on screen window
[screenXpixels, screenYpixels] = Screen(‘WindowSize’, window);

% Set up alpha-blending for smooth (anti-aliased) lines
Screen(‘BlendFunction’, window, ‘GL_SRC_ALPHA’, ‘GL_ONE_MINUS_SRC_ALPHA’);

%Set the TextFont & TextSize of the screen window
Screen(‘TextFont’, window, ‘Ariel’);
Screen(‘TextSize’, window, 40);

% Get the centre coordinate of the window
[xCenter, yCenter] = RectCenter(windowRect);

% Here we set the size of the arms of our fixation cross
fixCrossDimPix = 30;

% Now we set the coordinates (these are all relative to zero we will let
% the drawing routine center the cross in the center of our monitor for us)
xCoords = [-fixCrossDimPix fixCrossDimPix 0 0];
yCoords = [0 0 -fixCrossDimPix fixCrossDimPix];
allCoords = [xCoords; yCoords];

% Set the line width for our fixation cross
lineWidthPix = 4;

% Make a base Rect of 200 by 250 pixels
baseRect = [0 0 200 250];

% For Ovals we set a miximum diameter up to which it is perfect for
maxDiameter = max(baseRect) * 1.01;

% Center the rectangle on the centre of the screen
centeredRect = CenterRectOnPointd(baseRect, xCenter, yCenter);

% Set the color of the rect to gray
rectColor = [0.5 0.5 0.5];
penWidthPixels = 6;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% INSTRUCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%

DrawFormattedText(window,[‘Training Phase will begin now.\n\n’…
‘Press any key to continue.’], ‘center’, ‘center’, white);
Screen(‘Flip’, window);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TRIAL STRUCTURE %%%%%%%%%%%%%%%%%%%%%%%%%%%%
start = GetSecs;
for i_trial = 1:20
% curr = GetSecs; %Gets current time
% disp(curr-start); %Displays time since
% start=curr;
% Draw the fixation cross in white, set it to the center of our screen and % set good quality antialiasing
Screen(‘DrawLines’, window, allCoords,…
lineWidthPix, white, [xCenter yCenter], 2);

% Flip to the screen
Screen(‘Flip’, window);

% Wait for 500 ms
WaitSecs (0.5);

% Draw the rect to the screen
Screen(‘FrameOval’, window, rectColor, centeredRect, maxDiameter, penWidthPixels);
% Flip to the screen
Screen(‘Flip’, window);
WaitSecs (Delay_time (i_trial)); % random durations for which oval to be presented on screen

% Screen(‘FillOval’, window, [0 0 0], centeredRect); %blank screen
% Screen(‘Flip’, window);
% WaitSecs (1); %Wait for 1 sec

DrawFormattedText(window, ‘Short or Long ?’, ‘center’, ‘center’, white); % Question asked to Participants
Screen(‘Flip’, window)

% Clear the screen

Someone please help me out with this