Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. clear all
  2.  
  3. close all
  4.  
  5. KbName('UnifyKeyNames');
  6.  
  7. %%%%%%%%%%%%%%%%%%%%%%%%%%%%
  8.  
  9. [window, rect]=Screen('OpenWindow',0);
  10.  
  11. RED=KbName('1'); GREEN=KbName('2'); BLUE=KbName('3');
  12.  
  13. keysOfInterest=zeros(1,256);
  14. keysOfInterest([RED, GREEN, BLUE])=1;
  15. KbQueueCreate(-1, keysOfInterest);
  16. KbQueueStart;
  17.  
  18. WORDCOLORS = {'red', 'green', 'blue'};
  19.  
  20. rgbColors = [1000 0 0; 0 1000 0; 0 0 1000];
  21.  
  22. starttime=Screen('Flip',window);
  23.  
  24. KbQueueFlush;
  25.  
  26. % NumSecondsStart = GetSecs;
  27.  
  28. % while (NumSecondsEnd-NumSecondsStart) == 1
  29.  
  30. for phase = 1
  31.  
  32. design=repmat([1 2 3], 2, 2)';
  33.  
  34. if phase == 1
  35.  
  36. designRand=design(randperm(length(design)),:);
  37.  
  38. Word=WORDCOLORS(designRand(1:6));
  39.  
  40. Color=rgbColors(designRand(:,2),:);
  41.  
  42. end
  43.  
  44. for trial=1:6
  45.  
  46. if phase == 1
  47.  
  48. DrawFormattedText(window, Word{trial}, 'center' ,'center', Color(trial,:));
  49.  
  50. WaitSecs(rand+.5)
  51.  
  52. starttime=Screen('Flip',window);
  53.  
  54. [pressed, firstPress]=KbQueueCheck;
  55.  
  56. endtime=KbQueueWait();
  57.  
  58. RTtext=sprintf('Response Time =%1.2f secs',endtime-starttime);
  59.  
  60. DrawFormattedText(window,RTtext,'center' ,'center',[255 0 255]);
  61.  
  62. vbl=Screen('Flip',window);
  63.  
  64. Screen('Flip',window,vbl+1);
  65.  
  66. NumSecondsEnd =GetSecs;
  67.  
  68. end
  69. end
  70. end
  71.  
  72. % break;
  73.  
  74. % end
  75.  
  76. ListenChar(0);
  77.  
  78. ShowCursor();
  79. Screen('CloseAll');
  80.  
  81. if toc >= 2
  82. break
  83. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement