以相同的程序运行可以显示英文的积极词语和消极词语,但修改成中文的词语后就无法显示。
以下是程序
clear all
close all
Screen('Preference','Verbosity',0)
Screen('Preference','SkipSyncTests',1)
Screen('Preference','VisualDebugLevel',0)
BlockNum=1;
StimDura=500;
ISImin=1000;
ISImax=1500;
TxtSize=100;
TxtFont='Arial';
positive={'glad','pleased'};
negative={'depressed','sad'};
count=0;
for i=1:length(positive)
for j=1:length(negative)
count=count+1;
StimInd(count).positive=i;
StimInd(count).negative=j;
end
end
screenNum=0;
[wPtr,rect]=Screen('OpenWindow',screenNum);
HideCursor;
black=BlackIndex(wPtr);
white=WhiteIndex(wPtr);
monitorFlipInterval=Screen('GetFlipInterval', wPtr);
hz=FrameRate(wPtr);
flipSpd=(StimDura/1000)*hz;
ISIrange=((ISImax-ISImin)/1000)*hz;
ISImin=(ISImin/1000)*hz;
ISI=round(rand(BlockNum,length(StimInd))*ISIrange+ISImin);
Screen('Preference', 'TextEncodingLocale', 'UTF8') ;
vbl=Screen('Flip',wPtr);
for ii=1:BlockNum
Screen('TextSize', wPtr , TxtSize);
Screen( 'TextFont', wPtr ,TxtFont);
StimIndRand=StimInd(randperm(length(StimInd)));
for jj=1:length(StimInd)
[x,y]=WindowCenter(wPtr);
Screen('DrawText', wPtr, positive{StimIndRand(jj).positive}, x-100,y);
Screen('DrawText',wPtr,negative{StimIndRand(jj).negative},x+100,y);
vbl=Screen(wPtr, 'Flip', vbl+(ISI(ii,jj)*monitorFlipInterval));
vbl=Screen('Flip', wPtr, vbl+(flipSpd*monitorFlipInterval));
end
end
ISIlast=round(rand(1)*ISIrange+ISImin);
Screen('FillRect',wPtr,white);
Screen(wPtr, 'Flip', vbl+(ISIlast*monitorFlipInterval));
Screen('CloseAll');
ShowCursor