Problem with DrawDots

Hi there,

I’m trying to create two circular apertures on the same screen with moving dots inside.
I’m using Psychtoolbox version: 3.0.18 - Flavor: Manual Install and Windows 11 Pro Version 21H2 Build 22000.739
When I run the following:

% New random positions
dots.x.right.ang = (rand(1,dots.ndots)-.5)*dots.aperture.size(1);
dots.x.left.ang = (rand(1,dots.ndots)-.5)*dots.aperture.size(1);
dots.y.right.ang = (rand(1,dots.ndots)-.5)*dots.aperture.size(2);
dots.y.left.ang = (rand(1,dots.ndots)-.5)*dots.aperture.size(2);

% Use the equation of an ellipse to determine which dots fall inside.
gooddots.right = (^2/(dots.aperture.size(1)/2).^2 + (^2/(dots.aperture.size(2)/2).^2 < 1;
gooddots.left = (^2/(dots.aperture.size(1)/2).^2 + (^2/(dots.aperture.size(2)/2).^2 < 1;

% Dot positions in px
xyright = [dots.x.right.ang; dots.y.right.ang] .* ppd;
xyleft = [dots.x.left.ang; dots.y.left.ang] .* ppd;

xyrightgood = xyright .* gooddots.right;
xyleftgood = xyleft .* gooddots.left;

% Draw dots
Screen(‘DrawDots’, window, xyrightgood, dots.sizepx, dots.colour,, 1);
Screen(‘DrawDots’, window, xyleftgood, dots.sizepx, dots.colour,, 1);

it unfortunately only shows one dot on each side although my xy matrices contain 100 coordinates each (as they should since dots.ndots=100).
I just can’t figure out what’s wrong and would be very, very grateful for any and all help.

Thanks so much in advance!

If our DotDemo.m works then it isn’t a problem with Psychtoolbox or your system, but with how you calculate your dot positions. I’d check if xyrightgood and xyleftgood contain what you think they should and work backwards from there. DotRotDemo.m is another sample of placing dots in a circular aperture.