PsychToolbox doesn’t have a function to enable or disable the Windows screensaver, and the screensaver popping seems to crash PsychToolbox. Matlab allows you to run dos programs from the command line, so a quick way to solve this issue is to grab the command line app FlipSS, put it in your experiment directory, and then run this line before Screen(‘OpenWindow’):
dos('FlipSS /off');
After Screen(‘CloseAll’) or sca you can then run:
dos('FlipSS /on');
…to reenable the screen saver. A lot simpler than a DYI mex file, if you ask me.