matlab & PTB 学习笔记01——运行前准备

一、PsychDefaultSetup——基础功能快捷实现方式 

简介:相当于电话快捷拨号键,避免冗杂代码

等级分类

PsychDefaultSetup(0):执行AssertOpenGL命令,保证Screen()函数正常运行

PsychDefaultSetup(1):加上KbName(‘UnifyKeyNames’)

PsychDefaultSetup(2):加上Screen(‘ColorRange’, window, 1, [], 1) 背景白色

A ‘featureLevel’ of 2 will additionally imply the execution of

 Screen(‘ColorRange’, window, 1, [], 1); immediately after and whenever

PsychImaging(‘OpenWindow’,…) is called, thereby switching the default

color range from the classic 0-255 integer number range to the normalized

floating point number range 0.0 - 1.0 to unify color specifications

across differently capable display output devices, e.g., standard 8 bit

displays vs. high precision 16 bit displays. Please note that clamping of

valid color values to the 0 - 1 range is still active and colors will

still be represented by 256 discrete levels (8 Bit resolution), unless

you also use PsychImaging() commands to request unclamped color

processing or floating point precision framebuffers. This function by

itself only changes the range, not the precision of color specifications!

二、Screen('Preference','SkipSyncTests',1);

SyncTest是PTB启动前默认要对屏幕的各项进行检查,SkipSyncTests设置为1(True)表示强制跳过检查,因为很多参数我们已经了解或不关心。0(False)则系统会进行测试,可能会有报错。

三、Screen('Preference','ConserveVRAM',64);

简介:​​​​​​获取或设置Psychtoolbox首选项。首选项设置是全局的-它们 影响模块的所有操作,直到发生变化。

oldMode = Screen(‘Preference’, ‘ConserveVRAM’, mode); 设置保留虚拟内存(为什么是64不知道)。

四、Screen('Preference','TextEncodingLocale','UTF-8');

将显示时的解码方式设置为unicode 编码中的UTF8的解码方式,支持中文显示

其他方法:将需要的中文字符串转换成它的unicode编码串,也就是在前面加上double,将'中文' 改写成 double('中文');使用Screen('TextFont', window, 'Simsun'); 将显示字体设置为支持中文的字体,这里的Simsun指的是宋体。

作者:柳云间
链接:https://www.zhihu.com/question/41862021/answer/819333149
来源:知乎

五、screenNumber = max(Screen('Screens'));

窗口句柄(屏幕序号)有多个选择(0/1/2)实验时只使用一个显示屏。为保证代码的普适性,设置使用最后一个显示屏。

eg. 有两个显示屏,一个用于主试查看被试眼动情况,一个用于被试实验。


black = BlackIndex(screenNumber);   white = WhiteIndex(screenNumber);先读取黑、白色的索引值,设置背景颜色(想咋搞咋搞)

说明:color=WhiteIndex(windowPtrOrScreenNumber) 在屏幕外的窗口或纹理上不起作用,也就是WhiteIndex必须打开PTB。而BlackIndex源代码比较简单,只用一个数字就可以运行。

  • 5
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值