Errors with Psychtoolbox-3 on both MacBook Air (MacOS Catalina) and Windows operating systems

Hi,

I am neuroscience student new to programming (coming from a psychology background).

Although my laptop is MacOS Catalina, I downloaded both MATLAB R202b and Psychtoolbox-3 with no issue, following the instructions.

The script I have built is concerns a Stroop task.

In order to code I followed the documentations, manuals, video tutorial and demos. However, when I tried to run it on my Mac it did not work at all saying the following:

I searched on Matlab, Psychtoolbox, Reddit and GitHub community forums and tried the solutions gave in the answers, however, I keep encountering the same problem.

Additionally, I am unable to open mexa64 files, even when i changed them to mexmaci64 files as per Mac instructions.

I therefore switched on the university Windows computer as a remote users where MATLAB (R2019a) and Psychtoolbox-3 were already in function.

However I faced SYNC FAILURE message (exactly the same as the one that other novice programmers showed in their question to community) and errors with the following two line of code:

% Specify key names of interest

KbName=(‘RightArrow’);

KbName=(‘LeftArrow’);

KbName=(‘UpArrow’);

% Restrict the keys for keyboard input to the keys we want

RestrictKeysForKbCheck(KbName);

% Suppress echo to the command line for keypresses

ListenChar(2);

I tried possible solutions such as I disabled the synch tests in order to avoid synch failure at top of script with the following lines of code first:

[VBLTimestamp StimulusOnsetTime FlipTimestamp Missed Beampos] = Screen(‘Flip’, windowPtr [, when] [, dontclear] [, dontsync] [, multiflip]);

Screen(‘AsyncFlipBegin’, windowPtr [, when] [, dontclear] [, dontsync] [, multiflip]);

[VBLTimestamp StimulusOnsetTime FlipTimestamp Missed Beampos] = Screen(‘AsyncFlipEnd’, windowPtr);

[VBLTimestamp StimulusOnsetTime FlipTimestamp Missed Beampos] = Screen(‘AsyncFlipCheckEnd’, windowPtr);

[VBLTimestamp StimulusOnsetTime swapCertainTime] = Screen(‘WaitUntilAsyncFlipCertain’, windowPtr);

[telapsed] = Screen(‘DrawingFinished’, windowPtr [, dontclear] [, sync]);

framesSinceLastWait = Screen(‘WaitBlanking’, windowPtr [, waitFrames]);

Screen(‘Preference’,‘SyncTestSettings’ [, maxStddev=0.001 secs][, minSamples=50][, maxDeviation=0.1][, maxDuration=5 secs]);

Then I changed it to this:

% Disable the synch tests in order to avoid synch failure at top of script

Screen(‘Preference’, ‘Verbosity’, 0);

Screen(‘Preference’, ‘SkipSyncTests’,1);

Screen(‘Preference’, ‘VisualDebugLevel’,0);

And finally to this:

Screen(‘Preference’, ‘VBLTimestampingMode’, -1);

Screen(‘Preference’, ‘SkipSyncTests’, 2);

Moreover, I tried coding InitializeMatlabOpenGL; followed by Screen(‘BeginOpenGL’, window); and Screen(‘EndOpenGL’, window); any time I wanted to code something regarding the Screen() function.

%Screen presentation setup

AssertOpenGL;

Screen (‘Preference’, ‘SkipsyncTests’, 1); %Line of code that helps overriding psychtoolbox objections

Screen(‘Preference’,‘VisualDebugLevel’, 0); %Line of code that helps overriding psychtoolbox objections

Screen(‘Preference’,‘SuppressAllWarnings’, 1); %Line of code that helps overriding psychtoolbox objections

Screen(‘Preference’,‘ConserveVRAM’, 16384); %Line of code that helps overriding psychtoolbox objections

screens = Screen(‘Screens’);

screenNumber = max(screens);

InitializeMatlabOpenGL;

%Open white screen

Screen(‘BeginOpenGL’, window);

Screen (‘OpenWindow’,screenNumber, 255);

Screen(‘EndOpenGL’, window);

However, despite my effort in changing or adding lines of code and functions, the same errors kept popping up.

Now, the Screen() function is coded as follows:

%Screen presentation setup

AssertOpenGL;

Screen (‘Preference’, ‘SkipsyncTests’, 1); %Line of code that helps overriding psychtoolbox objections

Screen(‘Preference’,‘VisualDebugLevel’, 0); %Line of code that helps overriding psychtoolbox objections

Screen(‘Preference’,‘SuppressAllWarnings’, 1); %Line of code that helps overriding psychtoolbox objections

Screen(‘Preference’,‘ConserveVRAM’, 16384); %Line of code that helps overriding psychtoolbox objections

screens = Screen(‘Screens’);

screenNumber = max(screens);

[window, screenRect]=Screen(‘OpenWindow’,screenNumber, 255); %Open white screen

%Rectangle that will present stimuli

FixationRect = [0 0 5 5];

FixationRect = CenterRect(FixationRect, screenRect);

%Set font and size for introduction, word stimuli and end experiment message

Screen (‘OpenWindow’,0, 255);

Screen(‘TextFont’,window, char(‘Arial’));

Screen(‘TextSize’, window, 20);

Screen(‘FillArc’,window,255,FixationRect,0,360);

Screen(‘Flip’,window);

[xp, yp] = DrawFormattedText(window, ‘You will be now presented with one word at the time in the center of the screen \n\n The words can appear in Red, Green or Blue \n\n Press the LeftArrow key for words in Red, the RightArrow when it is Green and the UpArrow when it is Blue \n\n Please, disregard the meaning of the word \n\n Wait 4 secs to start’, ‘center’, ‘center’, 0);

Screen(‘Flip’,window);

WaitSecs(4);

Considering the aforementioned, could you please advise on what is best to do in order for my script to run smoothly?

Big thank you in advance for your kind help.

-Barb.

Hello Barbara

You get those invalid mex file errors because you apparently renamed the Screen mex file for Linux (which ends in .mexa64) into ending with .mexmaci64, thereby overwriting the Screen.mexmaci64 file for macOS and clearly Matlab for macOS doesn’t like getting fed a mex file for Linux. Who did tell you to do such an absurd thing?

I would delete that whole folder and then just follow our Download instructions for v3.0.17, which was tested on Catalina, from our website. Iow. follow steps 2 and 3 of:

Btw. the sync failure on the Windows remote computer likely happens because running timing-sensitive tasks over a remote connection will almost certainly not work with sufficient precision.

-mario