Thanks for your reply, I am pretty new to this so I don’t really know.
I’ve attached my full code below, it isn’t too long.
Any ideas from this would be appreciated.
Thanks,
Kyle
ListenChar(2); %stop input into MATLAB window
%generate random ID for ppts
a = [randperm(10,2)+47;randperm(26,2)+96];
b = char(a(:)');
c = convertCharsToStrings(b);
ScreenNumbers = Screen('Screens'); %find screens
OutScreen = max(ScreenNumbers); %output to max screen
Screen('Preference', 'SkipSyncTests', 1); %remove
[scrn, rect] = PsychImaging('OpenWindow',OutScreen, [175 175 175]);
Screen('TextSize',scrn,24); %Text Size
DrawFormattedText(scrn,['Thank you for taking part in this experiment. \n\n Please take time to read the information infront of you. \n\n Do not hesitate to ask any questions. \n\n Press any key to continue.'],'center','center');
Screen('flip', scrn); %Show Text on Display
KbStrokeWait; %wait for any keypress, [],[0 0 800 600]
DrawFormattedText(scrn, [b, '\n\n Your Unique Code is Displayed Above, \n\n Please Take Note of This. \n\n Press Any Key to Continue'], 'center', 'center')
Screen('flip', scrn); %Show text
KbStrokeWait; %wait for any keypress
DrawFormattedText(scrn,['You are about to be presented with a video. \n\n Please pay attention as you will be asked to recall events afterwards. \n\n When you are ready, press any key to play'], 'center', 'center');
Screen('flip', scrn); %Show text
Clip_1 = [PsychtoolboxRoot 'PsychDemos/MovieDemos/8.1.mov'];
% Wait until user releases keys on keyboard:
KbStrokeWait;
% Select screen for display of movie:
screenid = max(Screen('Screens'));
% Open movie file:
[movie] = Screen('OpenMovie', scrn, Clip_1);
% Start playback engine:
Screen('PlayMovie', movie, 1);
% Playback loop: Runs until end of movie or keypress:
while ~KbCheck
% Wait for next movie frame, retrieve texture handle to it
tex = Screen('GetMovieImage', scrn, movie);
% Valid texture returned? A negative value means end of movie reached:
if tex<=0
% We're done, break out of loop:
break;
end
% Draw the new texture immediately to screen:
Screen('DrawTexture', scrn, tex);
% Update display:
Screen('Flip', scrn);
% Release texture:
Screen('Close', tex);
end
% Stop playback:
Screen('PlayMovie', movie, 0);
% Close movie:
Screen('CloseMovie', movie);
DrawFormattedText(scrn,['Please press and hold space for how long you believe the video lasted. '],'center','center');
Screen('flip', scrn); %Show Text on Display
KbTriggerWait(KbName(['space']));
tic;
KbReleaseWait;
firstResponse = toc;
DrawFormattedText(scrn,['+'],'center','center');
Screen('flip', scrn); %Show Text on Display
WaitSecs(1);
DrawFormattedText(scrn,['The next video will play now. '],'center','center');
Screen('flip', scrn); %Show Text on Display
WaitSecs(5);
Clip_2 = [PsychtoolboxRoot 'PsychDemos/MovieDemos/8.1.mov'];
% Select screen for display of movie:
screenid = max(Screen('Screens'));
% Open movie file:
[movie] = Screen('OpenMovie', scrn, Clip_2);
% Start playback engine:
Screen('PlayMovie', movie, 1);
% Playback loop: Runs until end of movie or keypress:
while ~KbCheck
% Wait for next movie frame, retrieve texture handle to it
tex = Screen('GetMovieImage', scrn, movie);
% Valid texture returned? A negative value means end of movie reached:
if tex<=0
% We're done, break out of loop:
break;
end
% Draw the new texture immediately to screen:
Screen('DrawTexture', scrn, tex);
% Update display:
Screen('Flip', scrn);
% Release texture:
Screen('Close', tex);
end
% Stop playback:
Screen('PlayMovie', movie, 0);
% Close movie:
Screen('CloseMovie', movie);
DrawFormattedText(scrn,['Please press and hold space for how long you believe the video lasted. '],'center','center');
Screen('flip', scrn); %Show Text on Display
KbTriggerWait(KbName(['space']));
tic;
KbReleaseWait;
secondResponse = toc;
DrawFormattedText(scrn,['+'],'center','center');
Screen('flip', scrn); %Show Text on Displayb
WaitSecs(1);
DrawFormattedText(scrn,['Thank You'],'center','center');
Screen('flip', scrn); %Show Text on Display
T = table(c, firstResponse, secondResponse);
writetable(T,'Data.csv','WriteMode','Append','WriteRowNames',true)
KbStrokeWait;% wait for any keypress
Screen('CloseAll');
ListenChar(1); %Reinstate ability to type in MATLAB