0

我正在寻找一种在 Psychtoolbox (Matlab) 中将变量的值打印到屏幕上的方法。我正在寻找类似的东西fprintf:例如。fprintf('%s%d\n','Your score: ', score);

我猜这DrawFormattedText()就是我正在寻找的函数,但有人可以建议如何添加一个不属于字符串的变量吗?

谢谢。

4

1 回答 1

0

用于sprintf将数据格式化为 a ,然后将其从Psychtoolboxstring传递stringDrawFormattedText函数,如下所示:

score = rand;    % Random score value.
DrawFormattedText(win, sprintf('Your score: %d\n', score));
于 2017-05-06T02:49:42.907 回答