clearvars; close all; clc

load('Results-Toe-In.mat')

chosenSubject = 'S09';

Trials = fieldnames(Results.(chosenSubject));

figure;
set(gcf, 'Position', get(0, 'Screensize'));

for i = 1:length(Trials)
    
    syncTime = Results.(chosenSubject).(Trials{i}).C3Ddata.syncCorr;
    OptPos = Results.(chosenSubject).(Trials{i}).C3Ddata.MarkerPosition.RFootF;
    IntAcc = Results.(chosenSubject).(Trials{i}).inertial.dacc;
    
    OptAcc = diff(diff(sqrt(sum(OptPos.^2,2))));

    
    subplot(3,4,i)
    
    if syncTime > 0
        plot(OptAcc(syncTime:end))
        hold on;
        plot(IntAcc)
    else
        plot(OptAcc)
        hold on;
        plot(IntAcc(-syncTime:end))
    end
        
    

end