You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: spm_ADEM_set_rt.m
    path of file: ./repos/spm/toolbox/DEM
    
    the code of the file until where you have to start completion: function [on,rt,ac] = spm_ADEM_cue_rt(DEM)
% returns reaction times and accuracy for ADEM_cued_response demo
% FORMAT [on,rt,ac] = spm_ADEM_cue_rt(DEM)
%
% DEM - DEM structure from ADEM_cued_response.m
%
% on  - cue onset

    
function [on,rt,ac] = spm_ADEM_cue_rt(DEM)
% returns reaction times and accuracy for ADEM_cued_response demo
% FORMAT [on,rt,ac] = spm_ADEM_cue_rt(DEM)
%
% DEM - DEM structure from ADEM_cued_response.m
%
% on  - cue onset
% ac  - accuracy
% rt  - reaction time
%__________________________________________________________________________
 
% Karl Friston
% Copyright (C) 2008-2022 Wellcome Centre for Human Neuroimaging
 
% distance from target and cue contrast
%--------------------------------------------------------------------------
P   = DEM.pP.P{1};                            % location of targets
L   = DEM.pU.v{1}((1:2) + 2,:);               % location of finger
n   = length(P);                              % number of targets
N   = length(L);                              % number of time bins
D   = sparse(n,N);
for j = 1:N
    for i = 1:n
        D(i,j) = D(i,j) + sum((L(:,j) - P(:,i)).^2);
    end