필터 지우기
필터 지우기

Trying to get onset time of first keypress using a sliding scale in Psychtoolbox

조회 수: 1 (최근 30일)
Lisa M
Lisa M 2020년 2월 3일
편집: Lisa M 2020년 2월 3일
I have a slider which you can move left and right and I am trying to get the onset time of the first keypress. However, right now I only get the time for how long the rating scale is on the screen. Any suggestions?
Thanks in advance!
% Loop for scale loop
t0 = GetSecs;
answer = 0;
moved = 0;
firsttouch = 0;
while answer == 0
% Parse user input for x location
if strcmp(device, 'mouse')
[x,~,buttons,~,~,~] = GetMouse(screenPointer, 1);
elseif strcmp(device, 'keyboard')
[~, secsrating, keyCode, ~] = KbCheck;
if keyCode(responseKeys(2)) == 1 && firsttouch == 0
x = x - stepSize; % Goes stepSize pixel to the left
onset_rating = secsrating-t0;
firsttouch = 1;
elseif keyCode(responseKeys(2)) == 1 && firsttouch == 1
x = x - stepSize; % Goes stepSize pixel to the left
onset_rating=0;
elseif keyCode(responseKeys(3)) == 1 && firsttouch == 0
x = x + stepSize; % Goes stepSize pixel to the right
onset_rating = secsrating-t0;
firsttouch = 1;
elseif keyCode(responseKeys(3)) == 1 && firsttouch == 1
x = x + stepSize; % Goes stepSize pixel to the right
onset_rating=0;
end
else
error('Unknown device');
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by