Screen will not open because the id is 115

I programmed the majority of my task on my own personal laptop ( MacOS) but ran into some issues with using keyboard responses ( kbwait, kbcheck, etc). Now I am trying to debug this on dual Dell Monitors, but the operating system is MacOS. I mention the monitors since I suspect this is causing the issues with PsychImaging. Here is the code and the the error given:

Screen(‘Preference’, ‘SkipSyncTests’, 1);
ptb.ScreenID = max(‘Screens’);
ptb.bgColour = [1 1 1];
ptb.rect = [120 50 900 600];
[, ptb.winRect] = PsychImaging(‘OpenWindow’, ptb.ScreenID, ptb.bgColour, ptb.rect);
[ptb.xcenter, ptb.ycenter] = RectCenter(ptb.winRect);

Error using PsychImaging (line 1768)
Invalid screenId provided in ‘OpenWindow’ - no such screen 115 available.

Im not sure what it is that I can do so that screen id gets stored as 0 or 1

=== delete this after reading ===
Please post bugs you think you may have found or potential feature requests here. But please be aware that PTB is open source and there is is only one main developer who contributes their spare time to this project–be kind and have reasonable expectations.

If you are sure you have found a bug, you may instead wish to post to the PTB issue tracker. The issue tracker is the only place where bugs and feature requests are managed, and thus the place to post to make sure they are not lost.

When posting bugs, please provide sufficient information. Please make sure you read this post before posting. No one can help you or investigate further unless you provide a clear description of the software environment you are using and the suspected bug…
=== delete until here ===

max(‘Screens’) is not a PTB call, you’re missing Screen()

1 Like

Thanks! I ended up figuring this out too but I since I literally copied/pasted from my matlab/laptop it didnt make sense that it was not working.