Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all
- close all
- KbName('UnifyKeyNames');
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
- [window, rect]=Screen('OpenWindow',0);
- RED=KbName('1'); GREEN=KbName('2'); BLUE=KbName('3');
- keysOfInterest=zeros(1,256);
- keysOfInterest([RED, GREEN, BLUE])=1;
- KbQueueCreate(-1, keysOfInterest);
- KbQueueStart;
- WORDCOLORS = {'red', 'green', 'blue'};
- rgbColors = [1000 0 0; 0 1000 0; 0 0 1000];
- starttime=Screen('Flip',window);
- KbQueueFlush;
- % NumSecondsStart = GetSecs;
- % while (NumSecondsEnd-NumSecondsStart) == 1
- for phase = 1
- design=repmat([1 2 3], 2, 2)';
- if phase == 1
- designRand=design(randperm(length(design)),:);
- Word=WORDCOLORS(designRand(1:6));
- Color=rgbColors(designRand(:,2),:);
- end
- for trial=1:6
- if phase == 1
- DrawFormattedText(window, Word{trial}, 'center' ,'center', Color(trial,:));
- WaitSecs(rand+.5)
- starttime=Screen('Flip',window);
- [pressed, firstPress]=KbQueueCheck;
- endtime=KbQueueWait();
- RTtext=sprintf('Response Time =%1.2f secs',endtime-starttime);
- DrawFormattedText(window,RTtext,'center' ,'center',[255 0 255]);
- vbl=Screen('Flip',window);
- Screen('Flip',window,vbl+1);
- NumSecondsEnd =GetSecs;
- end
- end
- end
- % break;
- % end
- ListenChar(0);
- ShowCursor();
- Screen('CloseAll');
- if toc >= 2
- break
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement