clear all

subjects = 1:34;

load('P:/3018029.09/data_clean.mat');

performance_overall = [];
performance_easiest = [];

for iSubject = 1:length(subjects)
    
    data_subject = data(data.subject == subjects(iSubject), :);
    
    % Overall performance
    
    perf = sum(data_subject.correct)/length(data_subject.correct)*100;
    
    performance_overall = [performance_overall; perf];
    
    % Performance on eaiest trials
    
    % select stim level 1 & 12
    data_subject_stim1 = data_subject(data_subject.stimLevel == 1, :);
    data_subject_stim12 = data_subject(data_subject.stimLevel == 12, :);
    
    % calculate performance
    perf_stim1 = sum(data_subject_stim1.correct)/length(data_subject_stim1.correct)*100;
    perf_stim12 = sum(data_subject_stim12.correct)/length(data_subject_stim12.correct)*100;
    
    performance_easiest = [performance_easiest; perf_stim1, perf_stim12];
    
    clear perf perf_stim_1 perf_stim_12
    
end