try
    whichscreen = max(Screen('Screens')); % count the screens
    [w, rect] = Screen('OpenWindow', whichscreen, 0); % open it
    midsquare = CenterRect([0, 0, 100, 100], rect);
    squares = [AdjoinRect(midsquare, midsquare, RectLeft); ...
        midsquare; ...
        AdjoinRect(midsquare, midsquare, RectRight)];
    colors = [255/2, 255/2, 255/2; ...
        0, 0, 0; ...
        255/2, 255/2, 255/2];
    Screen('FrameRect', w, colors', squares', 5);
    Screen('Flip', w);
    KbWait;
    Screen('CloseAll');
catch
    screen('CloseAll')
    rethrow(lasterror)
end