2024年4月20日发(作者:)

一 设随机间隔:

inline中:

on= random (2000,6000)

解释: TextDisplay4为控件类型

(2000,6000)随机刺激间隔

2000ms4000ms 6000ms随机间隔

on=2000*random(1,3)

解释同上

二 打开端口命令

inline1:

打开端口命令:

ignalEnabled= True

请打开控件SoundOut1的端口

ignalPort= &H378

打开SoundOut1端口为H378(固定的)

SignalEnabled= True

关闭控件SoundOut1的端口

SignalPort= &H378

关闭控件SoundOut1的端口为H378

inline2:

ignalData= rib("Condition")

向ERPs发送控件SoundOut1的刺激信号(Mark),这个刺激信号从List中的condition(code)获取

三 选择语句使用

inline3:

1.假如反应为“1”或“3”,则标记为“1”或“3”;不反应则标记为“2”

=”1” or =”3” then

WritePort&H378,rib(“”)

elseWritePort &H378,2

endif

“Answer”是刺激的名称

此句应放在“Answer”后面

2. 当反应的按键是字母(如j、f)时:

“按f键读为1,按j键读为2,无需按键时读为3。”标在后面

= "f" then

writePort&H378,1

= "j" then

writePort&H378,2

elsewritePort &H378,3

endif

语句还可以写成ifthen

rib(“code”)=“5” and rib(“code2”)>0 and resp = "j" and Target. rib(“code”)=“5”then writePort

&H378,3

如果Target获得的刺激类型5,同时反馈刺激为J 那么向端口输出,mark为3

当然还可以继续增加And多个条件。

四,被试休息语句

inline4:

dima as Integer

a=rib("")

ifa mod 9=0 then

msgbox("Itis time to rest,you havefinished"&int(a/9)&"/10"&",Press SPACE tocontinute")

Endif

说明:

每9个trial休息一次,休息时已经完成了全部trial的10分之(a/9),"10"可根据具体实验修改

dimss as string

ss=inputbox("请输入文字","数据输入")

让被试输入中文,然后判断他答案的对错吗?

那样的话可以插入一个inline,复制以下语句

dimans as string

InputAns:

ans = AskBox("你的问题","默认的答案,没有可以省略")

if ans = "正确答案"then

'正确的情况

else

'错误的情况

'goto InputAns '如果需要被试输错了重新输入的话去掉本行开头的单引号

end if

五 行为数据提取,很复杂没有看懂感兴趣的可以自己学习

write the response of the stimulus to thedat file inorder to merge data

Dim x,y,z,a,g,j As string

x=

y=

a=rib("code")

g=rib("stim")

j=rib("resp")

IF = "a" THEN

y = 1

END IF

IF = "b" THEN

y = 2

END IF

Dim y1,z1,a1,x2,x3,x4 As integer

x1=x1+1

y1=val(y)

z1=val(z)

a1=val(a)

x2=x1+1

x3=val(g)

x4=val(j)

if <>""then

Write#1,x1,y1,a1,,,g

Write #1,x2,0,y1,0,0,j

x1=x1+1

else

Write #1,x1,y1,a1,,,g

x1=x1

end if

'Write #1,x1,0,z1,1,0