function output=read_presentation_log_sea_mri(input,i)
uncertainty_limit=35;
filepath=input.filepath; %('/home/marius/Dokumente/Project_2/SEA_youonly/logfiles/test-sea.log');
filefolder=input.filefolder; % ('/home/marius/Dokumente/Project_2/SEA_youonly/logfiles/');
version = input.version;
%%%% MAKE SURE THERE ARE NO CHARS LEFT !!!!!!!

[pres_log1,pres_log2]=importPresentationLog([fullfile(filepath,filefolder,version) '.log']);
disp(['Reading in' [fullfile(filepath,filefolder,version) '.log'] ' as ' input.SubjectIDs{i}])
pres_log2.time = pres_log2.time(1:size(pres_log2.time,1));
%if size(pres_log2.duration,1)<size(pres_log2.code,1)
%for e=size(pres_log2.duration,1):size(pres_log2.code,1)
%pres_log2.code{e}=[];
%end
%end
%pres_log2.ttime
if any(pres_log2.uncertainty>uncertainty_limit)
    disp(['CAUTION: some uncertainties exceed the limit of ' num2str(uncertainty_limit)])
end
input.pres_log.subject=pres_log2.subject;
input.pres_log.duration=pres_log2.duration;
input.pres_log.event_type=pres_log2.event_type;
input.pres_log.time=pres_log2.time;
input.pres_log.codes=pres_log2.code;



index_Welcome = [];
index_Screen = [];
index_Question_you = [];
index_Question_other = [];
index_Answer_you = [];
index_Answer_other = [];
index_Start_ability = [];
index_End_ability = [];
index_Pulse=[];
%keyboard;
for e=1:length(pres_log2.code)
    temp=pres_log2.code{e};
    %if length(temp)>1
    temp2=pres_log2.event_type{e};
    if strcmp('Welcome_screen',temp)
        index_Welcome=[index_Welcome;e];
        
        
    elseif strcmp('Screen',temp)
        index_Screen=[index_Screen;e];
        
        %                     choices=[choices;temp(16)];
    elseif strcmp('Question_you_redblue',temp) || strcmp('Question_you_bluered',temp)
        index_Question_you=[index_Question_you;e];
        
    elseif strcmp('Question_other_redblue',temp) || strcmp('Question_other_bluered',temp)
        index_Question_other=[index_Question_other;e];
        
    elseif strcmp('start_ability', temp)
        index_Start_ability=[index_Start_ability;e];
        
    elseif strcmp('end_ability', temp)
        index_End_ability=[index_End_ability;e];
        
%     elseif strcmp('65', temp)    %'65'  '65' '67' '97' '98' '99'
%         index_Pulse=[index_Pulse;e];
%     elseif strcmp('65', temp)    %'65'  '66' '67' '97' '98' '99'
%         index_Pulse=[index_Pulse;e];
%     elseif strcmp('67', temp)    %'65'  '66' '67' '97' '98' '99'
        %index_Pulse=[index_Pulse;e];
    elseif strcmp('97', temp) && strcmp('Pulse',temp2)   %'65'  '66' '67' '97' '98' '99'
        index_Pulse=[index_Pulse;e];
%     elseif strcmp('98', temp)    %'65'  '66' '67' '97' '98' '99'
%         index_Pulse=[index_Pulse;e];
%     elseif strcmp('99', temp)    %'65'  '66' '67' '97' '98' '99'
%         index_Pulse=[index_Pulse;e];
        
    end
    
    
    
    input.pres_log.indices.index_Welcome=index_Welcome;
    input.pres_log.indices.index_Screen=index_Screen;
    input.pres_log.indices.index_Question_you=index_Question_you;
    input.pres_log.indices.index_Question_other=index_Question_other;
    input.pres_log.indices.index_Answer_you=index_Answer_you;
    input.pres_log.indices.index_Answer_other=index_Answer_other;
    input.pres_log.indices.index_Start_ability=index_Start_ability;
    input.pres_log.indices.index_End_ability=index_End_ability;
    input.pres_log.indices.index_Pulse=index_Pulse;
    %         %input.pres_log.durations.Welcome=pres_log2.duration(index_Welcome);
    %         input.pres_log.timing.Welcome=pres_log2.time(index_Welcome);
    %
    %         %input.pres_log.durations.Screen=pres_log2.duration(index_Screen);
    %         input.pres_log.timing.Screen=pres_log2.time(index_Screen);
    %
    %         input.pres_log.durations.Question_you=pres_log2.duration(index_Question_you);
    %         input.pres_log.timing.Question_you=pres_log2.time(index_Question_you);
    %         input.pres_log.durations.Question_other=pres_log2.duration(index_Question_other);
    %         input.pres_log.timing.Question_other=pres_log2.time(index_Question_other);
    %
    %         input.pres_log.durations.Answer_you=[pres_log1(index_Answer_you).duration]';
    %         input.pres_log.timing.Answer_you=[pres_log1(index_Answer_you).time]';
    %         input.pres_log.durations.Answer_other=[pres_log1(index_Answer_other).duration]';
    %         input.pres_log.timing.Answer_other=[pres_log1(index_Answer_other).time]';
    
    
    input.pres_log.answer.button = pres_log2.code(index_Answer_you);
    input.pres_log.answer.self.redfirst = [];
    input.pres_log.answer.self.redchoice = [];
    input.pres_log.answer.other.redfirst = [];
    input.pres_log.answer.other.redchoice = [];
    
    
end


output=input;




