Hi,
I noticed that the timestamps for incorrect trials are not showing up in the analog data, as if the timing script only sends event codes for successful trials.
Here is the timing script. Is there something that I miss?
Thank you
Anna
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
button = ML_ButtonsAvailable;
if length(button)<1, error('This task requires at least one button. Please set it up or try the simulation mode.'); end
hotkey('x', 'escape_screen(); assignin(''caller'',''continue_'',false);');
bhv_code(10,'Fixation',1,'LeftHand 1',2,'RightHand 2',20,'Sample',40,'Target',50,'Reward'); % behavioral codes
dashboard(1,''); %
dashboard(2,''); %
dashboard(3,''); %
dashboard(4,''); %
dashboard(5,''); %
fixation_point = 1;
sample = 2;
target = 3;
% distractor = 4;
fix_code=10;
sample_code=20;
% target_code=40;
max_reaction_time = 2000;
sample_time=800;
fix_time=100;
error_type = 0;
% initial fixation:
dashboard(1,'Fix Point on');
if error_type == 0
t_target =toggleobject(fixation_point, 'eventmarker',10); % turn on target)
[chosen_target,~,t_acquired] = eyejoytrack('acquiretouch',[1 2],[],fix_time)
if chosen_target
if 1==chosen_target
toggleobject(fixation_point);
ontarget = eyejoytrack('holdtouch', 1, [], 100);
error_type = 2;
dashboard(2,'Button 1 in advance')
else
toggleobject(fixation_point);
ontarget = eyejoytrack('holdtouch', 2, [], 100);
error_type = 2;
dashboard(2,'Button 2 in advance')
end
end
end
% Sample
if error_type == 0
dashboard(1,'Sample on');
toggleobject(fixation_point)
t_target =toggleobject(sample, 'eventmarker',20); % turn on target)
[chosen_target,~,t_acquired] = eyejoytrack('acquiretouch',[1 2],[],sample_time)
if chosen_target
if 1==chosen_target
toggleobject(fixation_point);
ontarget = eyejoytrack('holdtouch', 1, [], 100);
error_type = 3;
dashboard(2,'Button 1 in advance')
else
toggleobject(fixation_point);
ontarget = eyejoytrack('holdtouch', 2, [], 100);
error_type = 3;
dashboard(2,'Button 2 in advance')
end
end
end
% Target
if error_type == 0
dashboard(1,'Target on');
toggleobject(sample)
t_target =toggleobject(target, 'eventmarker',40); % turn on target)
[chosen_target,~,t_acquired] = eyejoytrack('acquiretouch',[1 2],[],max_reaction_time)
if chosen_target
if 1==chosen_target
toggleobject(target);
ontarget = eyejoytrack('holdtouch', 1, [], 100);
dashboard(2,'Correct')
rt = t_acquired - t_target;
elseif 2 == chosen_target
toggleobject(target);
ontarget = eyejoytrack('holdtouch', 2, [], 100);
error_type = 4;
dashboard(2,'Wrong')
rt = t_acquired - t_target;
end
else
error_type = 5; % no response
dashboard(2,'No response')
end
end
toggleobject([sample target fixation_point],'status','off'); % clear screens
if 0==error_type
idle(200);
end
if 0==error_type
goodmonkey(200, 'juiceline',1, 'numreward',1, 'eventmarker',50); % 100 ms of juice x 2
dashboard(2,'Reward');
else
idle(700);
end
trialerror(error_type); % add the result to the trial history
set_iti(2000);