try
    screens = Screen('Screens');
    whichscreen = max(screens)
    [w, rect] =Screen('Openwindow', whichscreen);
    mytext = 'MATLAB';
    DrawFormattedText(w, mytext, 'center', 'center');
    Screen ('Flip', w);
    KbWait;
    Screen('Close', w)
catch
    Screen('Close',w)
    rethrow(lasterror)
end