% Collection of calls to evaluate the accuracys
load('/home/jph/Uni/masterarbeit/evaluation.mat')

figureSavePath='/home/jph/Uni/masterarbeit/text/thesis/pictures/results/';
% mySaveFigure(gcf,strcat(figureSavePath,'plot'))
%% compare forms of recording
eegAcc=struct2array(accuracys.EEG);
emgAcc=struct2array(accuracys.EMG);
LFAcc=struct2array(accuracys.LF);
EEG=cell(size(eegAcc(:,1:end-1),2),1);
EEG(:)={'EEG'};
EMG=cell(size(emgAcc(:,1:end-1),2),1);
EMG(:)={'EMG'};
LF=cell(size(LFAcc(:,1:end-1),2),1);
LF(:)={'LF'};

anova1(cat(2,eegAcc(:,1:end-1),emgAcc(:,1:end-1),LFAcc(:,1:end-1)),cat(1,EEG,EMG,LF))
ylabel('% classified correctly')
title('ANOVA for EEG, EMG and LF')

%% evaluate single form of recording
input=accuracys.EMG;
sizeY=2;
limits_y=[100,0];

names=fieldnames(input);
noOfPlots=size(names,1);

for i=1:noOfPlots
    limits_y=[min(min(input.(sprintf('%s',names{i}))),limits_y(1)),...
        max(max(input.(sprintf('%s',names{i}))),limits_y(2))];
end
limits_y=[limits_y(1)-0.1*diff(limits_y),limits_y(2)+0.1*diff(limits_y)]

figure();
sizeX=ceil(noOfPlots/sizeY);
for i=1:noOfPlots
    subplot(sizeY,sizeX,i)
    boxplot(input.(sprintf('%s',names{i})))
    title(names{i})
    ylim(limits_y)
    if ceil(i/sizeX) > ceil((i-1)/sizeX)
        ylabel('% classified correctly')
    end
end

anova1(cat(2,input.default3Syn,input.offset1Syn3,input.offset2Syn3,input.pause1Syn3,input.pause1Off1Syn3),[0,0,0,1,1])
anova1(cat(2,input.default3Syn,input.offset1Syn3,input.pause1Syn3,input.pause1Off1Syn3),[0,1,0,1])
