MATLAB Answers

(Psychtoolbox) In a For loop, how do I write and record a response, if no key is pressed after 2 seconds (to signify a NoGo response i.e. a recorded response of 0)?

조회 수: 3(최근 30일)
Mohd Irfan Mohd Shofian
I'm not sure what I'm missing but below are my codes
for i = 1:n_trials
%show image%
if rand_conditions(i) == 1 %1 is defined as the Go trials with cross sign
stimulus_id = stimulus (i);
texture = Screen('MakeTexture', w, stimuli{stimulus_id});
elseif rand_conditions(i) == 0 %2 is defined as the NoGo trials with horizontal line
stimulus_id= stimulus (i);
texture = Screen('MakeTexture', w, stimuli{stimulus_id});
end
%check if the key codes pressed are the expected members%
start_time = GetSecs;
stop_resp = 0;
keyIsDown = 0;
while keyIsDown == 0 && stop_resp == 0
[keyIsDown,secs,keycode] = KbCheck;
end
pressed_code = find(keyCode == 1);
if pressed_code == KbName ('space bar') && cur_condition == 1 %%%%%%% A Go response %%%%%%%%%
stop_resp = 1;
resp = 1;
else
stop_resp=1;
resp=0;
end
if GetSecs - start_time > 2
keyIsDown == 1;
resp = 1;
end
end

  댓글 수: 0

로그인 to comment.

답변(0개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그


Translated by