Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- patientID='testgav';
- alphabet=['a':'z' '0':'9' '0':'9'];
- outputvarFile=['D:\Timing Task\' patientID '_Timing_' alphabet(randi(46,1,7)) '.mat'];
- numTrials=15;
- %% Triggers
- TrialStruct = struct();
- TrialStruct = Setup_DAQ_Stim(TrialStruct);
- %Trigger codes
- Correct=1;
- Incorrect=2;
- TimedOut=3; %patient didn't hit target within window
- %% Define Keypresses
- responseCodes = [0 0 0 0];
- TrialStruct.LeftKey = 'a'; % Corresponds to 1-key.
- TrialStruct.MidKey = 's'; % Corresponds to 2-key.
- TrialStruct.RightKey = 'd'; % Corresponds to 3-key.
- TrialStruct.EscKey = 'Escape'; % Corresponds to quit key.
- responseCodes(1) = KbName(TrialStruct.LeftKey);
- responseCodes(2) = KbName(TrialStruct.MidKey);
- responseCodes(3) = KbName(TrialStruct.RightKey);
- responseCodes(4) = KbName(TrialStruct.EscKey);
- %%
- Screen('Preference', 'SkipSyncTests', 1);
- PsychDefaultSetup(2);
- screens = Screen('Screens');
- screenNumber = max(screens);
- % Define black, white and grey
- black = BlackIndex(screenNumber);
- white = WhiteIndex(screenNumber);
- grey = white / 2;
- % Open an on screen window and color it grey
- [window, windowRect] = PsychImaging('OpenWindow', screenNumber, grey);
- % Set the blend funciton for the screen
- Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
- % Get the size of the on screen window in pixels
- % For help see: Screen WindowSize?
- [screenXpixels, screenYpixels] = Screen('WindowSize', window);
- % Get the centre coordinate of the window in pixels
- % For help see: help RectCenter
- [xCenter, yCenter] = RectCenter(windowRect);
- line1 = 'This task is called "Mismatched Duration."';
- line2 = '\n Your goal is to determine which stimulus is longer or shorter.';
- line3 = '\n\n You will see a shape appear on the screen for a given amount of time, then disappear. Keep track of how long it is on the screen.';
- line4 = '\n\n\n After a pause, a second shape will appear for another amount of time.';
- line5 = '\n\n\n\n The second shape will disappear, and you will say if the second shape was on the screen longer or shorter than the first shape.';
- line6 = '\n\n\n\n\n Please use the A Key to indicate "shorter," and the D Key to indicate "longer."';
- line7 = '\n\n\n\n\n\n Ready?';
- % Draw all the text in one go
- Screen('TextSize', window, 20);
- DrawFormattedText(window, [line1 line2 line3 line4 line5 line6 line7],...
- 'center', screenYpixels * 0.25, white);
- % Flip to the screen
- Screen('Flip', window);
- % Now we have drawn to the screen we wait for a keyboard button press (any
- % key) to terminate the demo
- KbStrokeWait;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement