正在加载图片...
14 sInitialize the output variables 15 keys =() 16 RT=[]: 17 18 Read the clock if no clock time was provided 19if ~exist ('startTime') 20 startTime GetSecs; 21 end 22 23 sGive a warning if the waiting interval is zero or less 24if GetSecs-startTime waitTime 25 disp('Warning!waitTill:waiting interval is less than zero') 26 end 27 8 sTurn off the output to the command window 29 ListenChar(2); Q:如何设置必须要按键才行? 3 nKeys 0; sloop until waitTime seconds has passed since startTime was defined 33 while GetSecs-startTime waitTime %如果还处在等待按键反应的时间内 34 ssee if a key is pressed 35 【keyIsDown,timeSecs,keyCode】=bCheck;.%检查按键行为 36白 if keyIsDown sa key is down:record the key and time pressed 37 nKeys-nKeys+i;%计算总的按键次数 38 RT(ney3)=timeSeca3-3 cartTime:%计算当次按键反应时间(当前时间-起始时间) 39 keys(nKeys)=KbName(keyCode) 40 sclear the keyboard buffer %查看按键内容 41 while KbCheck:end 42 end 43 end sTurn on the output to the command window 45 ListenChar(0); 46 %如果还处在等待按键反应的时间内 %检查按键行为 %计算总的按键次数 %计算当次按键反应时间(当前时间-起始时间) %查看按键内容 Q:如何设置必须要按键才行?
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有