Error when using DrawFormattedText in Psychtoolbox

9 次查看(过去 30 天)
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!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Timing and presenting 2D and 3D stimuli 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by