从今天开始,我打算边解释 PTB 自带的 demo 程序,边讲解一些涉及到的知识点,这样进度会快一点。
PTB 的 demo 可以在 Psychtoolbox Demos 网站上获取。另外,在安装目录的 PsychDemos 文件夹下也有大量的 demo 程序。
这次介绍下 Screen 的窗口操作。
在屏幕上显示一些内容,是我们用得最多的功能。要在屏幕上显示内容,需要先打开一个窗口。
Psychtoolbox Demos 网站上的第一个 demo 就演示了如何打开窗口,并获得一些其他信息。
% 第一块 Clear the workspace and the screen
sca;
close all;
clearvars;
% 第二块 Here we call some default settings for setting up Psychtoolbox
PsychDefaultSetup(2);
% 第三块 Get the screen numbers. This gives us a number for each of the screens
% attached to our computer.
screens = Screen('Screens');
% 第四块 To draw we select the maximum of these numbers. So in a situation where we
% have two screens attached to our monitor we will draw to the external
% screen.
screenNumber = max(screens);
% 第五