Error when using DrawFormattedText in Psychtoolbox

6 visualizzazioni (ultimi 30 giorni)
I want some text to be displayed in the screen by using PsychToolbox (MatlabR2019b, Windows). I am using the "DrawFormattedText" function, but when I do I get an error that I cannot solve myself. Here is my simplified code:
function pruebahelp
backcolor = [200 200 200];
res = [400 400];
[win, rect] = Screen('OpenWindow',0,backcolor,[0 0 res(1) res(2)])
Instr1 = ['Hello world'];
Instr = [Instr1];
DrawFormattedText(win, Instr, 'center', 'center',[0 0 0]);
Screen('Flip', win);
pause(3)
sca
end
When running this code i get the following error:
% Error using Screen
% Usage:
% [normBoundsRect, offsetBoundsRect, textHeight, xAdvance] = Screen('TextBounds', windowPtr, text [,x] [,y] [,yPositionIsBaseline]
% [,swapTextDirection]);
% Error in DrawFormattedText (line 295)
% theight = RectHeight(Screen('TextBounds', win, tstring));
% Error in pruebahelp (line 11)
% DrawFormattedText(win, Instr, 'center', 'center',[0 0 0]);
I would appreciate some help!

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by