Hi,
I am having trouble getting my code to run. It keeps getting stuck on the beginning screen in which I have a bit of text saying “Press any key to begin”. The script I am using is below.
%% to open the screen
screens=Screen(‘Screens’);
screenNumber=max(screens);
[w1,rect]=Screen(‘OpenWindow’,screenNumber,0); %Opens screen, generate w1(numeric window value) and rect (screen coordinates)
[center(1),center(2)] = RectCenter(rect); %compute center of screen
Priority(MaxPriority(w1)); %Prioritises experiment window so no pop ups occur
HideCursor();
Screen(‘DrawText’,w1,‘Press any key to begin’,center(1)-100,center(2)-10,255);
Screen(‘Flip’,w1);
pause;
Screen(‘Flip’,w1);
WaitSecs(1);
Then the code goes into an if loop to present the stimuli. Sometimes if I wait long enough on the initial screen it will present the stimuli. So I know the stimuli works but I am not sure why my screen is getting frozen on this initial screen for so long.
When I close the window I get the following error message:
Error in function Flip: Invalid Window (or Texture) Index provided: It doesn’t correspond to an open window or texture.
Does anyone have any ideas how I can troubleshoot this please?