在 Psychtoolbox 中打印变量值
Printing variable value in Psychtoolbox
我正在寻找一种在 Psychtoolbox (Matlab) 中将变量值打印到屏幕的方法。我正在寻找类似 fprintf
的内容:例如。 fprintf('%s%d\n','Your score: ', score);
我猜 DrawFormattedText()
是我正在寻找的函数,但是有人可以建议如何添加不属于字符串一部分的变量吗?
谢谢。
像这样使用sprintf
to format data into a string
and then pass that string
to the DrawFormattedText
function from the Psychtoolbox:
score = rand; % Random score value.
DrawFormattedText(win, sprintf('Your score: %d\n', score));
我正在寻找一种在 Psychtoolbox (Matlab) 中将变量值打印到屏幕的方法。我正在寻找类似 fprintf
的内容:例如。 fprintf('%s%d\n','Your score: ', score);
我猜 DrawFormattedText()
是我正在寻找的函数,但是有人可以建议如何添加不属于字符串一部分的变量吗?
谢谢。
像这样使用sprintf
to format data into a string
and then pass that string
to the DrawFormattedText
function from the Psychtoolbox:
score = rand; % Random score value.
DrawFormattedText(win, sprintf('Your score: %d\n', score));