这次的PTB实验我几乎每一个代码块都写了注释,应该比较容易看懂
function ret=imageInstruct(wptr,prefix,postfix,fs)
imgs.('img') = imread([prefix '.' postfix]);
wrect = Screen('Rect',wptr);
Screen('PutImage',wptr,imgs.img); %展示图片
Screen('Flip',wptr);
spaceKey = KbName('space'); %定义按键
ListenChar(2); %把按键锁定在实验中
while true
[~,~,keycode]=KbCheck;
if keycode(spaceKey)
break; %等待按空格键
end
end
KbWait;
ListenChar(0); %释放按键
clear imgs;
ret=0;
end
接下来我会贴出好几个功能模块,可以按需使用。