Get Response in Experiment
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi guys,
I'm trying to make an experiment in which after a second interval I need the participant to respond using either the left or right arrow button. I have the response function from someone else (see 'getaresponse.m' below) and I just can't figure out where in the code of my experiment to put it. I think it really shouldn't be that hard, but I've tried just about everything now and hope someone can help. (: Oh, and I'm using PsychToolbox.
function counterclockresponse = getaresponse;
while 1
[keyisdown,when,keyCode] = KbCheck;
if keyisdown
if strcmp(KbName(keyCode),'left') % left arrow
counterclockresponse = 1;
break;
elseif strcmp(KbName(keyCode),'right') % right arrow
counterclockresponse = 0;
break
elseif strcmp(KbName(keyCode),'q') % q button
counterclockresponse = 0;
screen closeall;
return;
end
end
end
I was thinking it should be something like this (posting the entire code would be far to much, so if you need any other parts let me know, but I hope this will suffice):
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%show the 2nd interval %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for frame = 1:presentationframes
Screen('DrawTexture', w, tex2,sr,dst);
fixationcross(w,fixvhdim,linewidth,screenrect);
Screen('Flip', w);
end
% erase the screen
Screen(w,'fillrect',backgroundcolor);
writetexttoscreen(w,responsetext,screenrect);
!!! counterclockresponse = getaresponse;
Screen('Flip', w);
end
Screen closeall;
ShowCursor;
Many thanks in advance.
~Nastasia
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Timing and presenting 2D and 3D stimuli finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!