% Part 3 – reaction to an image presented randomly among several other images % RECOGNITION REACTION TIME msgbox('In this module there are 3 colors displayed in random order. Press any key ONLY when the green image is displayed. Now click OK and press any key.') sprintf('Get ready for part 1 and press any key...') pause red=ones(500,500); red(:,:,2)=zeros(500,500); red(:,:,3)=zeros(500,500); green=zeros(500,500); green(:,:,2)=ones(500,500); green(:,:,3)=zeros(500,500); blue=zeros(500,500); blue(:,:,2)=zeros(500,500); blue(:,:,3)=ones(500,500); black=zeros(500,500,3); white=ones(500,500,3); yellow=ones(500,500); yellow(:,:,2)=ones(500,500); yellow(:,:,3)=zeros(500,500); close all figure(1) axis off hold on num=0; while num<10 n=ceil(5*rand(1,1)); switch n case 1 imagesc(red) pause(1.5) imagesc(black) pause(0.25) case 2 num=num+1; imagesc(green) tic pause times(num)=toc; imagesc(black) pause(0.25) case 3 imagesc(blue) pause(1.5) imagesc(black) pause(0.25) case 4 imagesc(yellow) pause(1.5) imagesc(black) pause(0.25) case 5 imagesc(white) pause(1.5) imagesc(black) pause(0.25) end end close times srednia = mean(times) plot(times,'gx-') xlabel('sample/probka') % x-axis label ylabel('time/czas [s]') % y-axis label msgbox('End of module.')