matlabpsychtoolbox

Fail to use Screen('Preference') in PsychToolbox for MATLAB


In PsychToolbox for MATLAB, I try to put

Screen('Preference', 'SyncTestSettings', maxStddev = 0.001, minSamples = 50, maxDeviation = 0.1, maxDuration = 5);

in the MATLAB command window, but it keeps to tell me:

Error in function Preference:   Extra input argument described
Error using Screen
Usage:
 
oldPreferenceValue = Screen('Preference', preferenceName,
[newPreferenceValue])

I was confused. The document given by PsychToolbox is:

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

Is there anything I misunderstand the document? And what is the correct command?

(My MATLAB is R2021a, and PsychToolbox is 3.0.17.12)


Solution

  • What you are trying to accomplish can be done with the following command:

    Screen('Preference', 'SyncTestSettings', 0.001, 50, 0.1, 5)
    

    You have to provide these values in the correct order. If you wanted to skip over a value (i.e., leave it as is) then use

    []
    

    like so:

    Screen('Preference', 'SyncTestSettings', 0.001, [], 0.1, 5)