New User visualization

Im just getting started on trying to things going. I have run into issues after spending 2 full days on one thing.
Very simply, I am getting an error on Screen function (see below).

The goal of this section of code, is to create a floating white screen with a grey dot (different sizes )on the right and left side of the screen. As far as the screen spatial features, I don’t think I am having any issue. I used the information from the demo, and 2 Youtubes which do not detail the differences between the arguments and and how to make the drawDot function apply to the creation of circles. Pls help

Screen('Preference', 'SkipSyncTests', 1);
screens = Screen('Screens'); % calls all screens and stores in "screens' variable
screenNumber = min(screens);
whitecol = [255 255 255];
startXpix = 120;
startYpix = 50;

% Dimensions in pixels of our window in the X (left-right) and Y (up down)
% dimensions
dimX = 400;
dimY = 250;

[outWindow, rect]=Screen('OpenWindow',screenNumber,whitecol,...
[startXpix startYpix startXpix + dimX startYpix + dimY]);

Screen('Flip', outWindow)

greycol = 150;
penwidth = 5;
centerx=(rect(3)/2);
centery=(rect(4)/2);
Screen('BlendFunction', outWindow, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

Screen('DrawDots', Outwindow, [centerx centery], 50, greycol, 2)
Screen('Flip', outWindow)

Well you have a typo with outWindow and Outwindow which will stop MATLAB as variables are case sensitive. But you are also misunderstanding DrawDots:

[...] = Screen('DrawDots', windowPtr, xy [,size] [,color] [,center] [,dot_type][, lenient]);

 "xy" is a two-row vector containing the x and y coordinates of the dot centers, relative to "center" (default center is [0 0]).

The screen center is passed in the center parameter. xy is the dot position relative to this center. Here is some working code, that also uses PTB functions like RectCenter and the future-proof 0-1 colour range:

Screen('Preference', 'SkipSyncTests', 2);
PsychDefaultSetup(2)
ptb.ScreenID = min(Screen('Screens'));
ptb.bgColour = [1 1 1];
ptb.rect = [120 50 520 300];
PsychImaging('PrepareConfiguration');
[ptb.win, ptb.winRect] = PsychImaging('OpenWindow', ptb.ScreenID, ptb.bgColour, ptb.rect);
[ptb.xcenter, ptb.ycenter] = RectCenter(ptb.winRect);
ptb.ifi = Screen('GetFlipInterval', ptb.win);
ptb.fps = 1 / ptb.ifi;
Screen('BlendFunction', ptb.win, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

ptb.white = WhiteIndex(ptb.win);
ptb.black = BlackIndex(ptb.win);
ptb.grey = white/2;
dotSize = 50;

% Screen('DrawDots', windowPtr, xy [,size] [,color] [,center] [,dot_type][, lenient]);
Screen('DrawDots', ptb.win, [0 0], dotSize, ptb.grey, [ptb.xcenter, ptb.ycenter]);
Screen('Flip', ptb.win);

WaitSecs(1);
sca;

Hi, thank you for your response. This code was helpful and I understand everything except the ptb.ifi and ptb.fps which is not a problem, I looked it up. I still ran into an error and it seemed to be related to the color indexing. However I just specified the color code I needed.

When you use the recommended PsychDefaultSetup(2), colour is specified as RGB with a 0 to 1 range. Pure red is [1 0 0], white is [1 1 1] etc. You can also specify alpha as blending has been enabled, so [1 0 0 0.5] is a half-opaque red, and overlaying two dots should blend their colours together:

dotXY = [-10 0;10 0]';
dotColours = [1 0 0 0.5;0 1 0 0.5]';
Screen('DrawDots', ptb.win, dotXY, dotSize, dotColours, [ptb.xcenter, ptb.ycenter],2);
Screen('Flip', ptb.win);