clear all; close all; clc;
opts = delimitedTextImportOptions("NumVariables", 40);
opts.DataLines = [2, Inf];
opts.VariableNames = ["ID", "DrivingStyleCoastingDifficultyLevel", "DrivingStyleCruiseControl", "DrivingStyleCruiseControlDifficultyLevel", "DrivingStyleIdling", "DrivingStyleIdlingDifficultyLevel", "DrivingStyleTotalDifficultyLevel", "EndDate", "DrivingStyleCoasting", "Safety", "TotalTimeOverZero", "DrivingStyleTotal", "DrivingStyleAccelerationWeightingFactor", "DrivingStyleBreakingWeightingFactor", "DrivingStyleCoastingWeightingFactor", "DrivingStyleCruiseControlWeightingFactor", "DrivingStyleIdlingWeightingFactor", "StartDate", "DrivingStyleBreakingDifficultyLevel", "DrivingStyleBreaking", "DrivingStyleAccelerationDifficultyLevel", "VinNumber", "DriverIdentification", "FuelConsumptionLiter", "FuelConsumptionExpectedLiter", "FuelConsumptionAverage", "FuelSavedLiter", "FuelSavedCo2", "FuelSavedCurrency", "DistanceKm", "AverageSpeedKmHour", "EstimatedWeight", "ApiWebserviceId", "TrafficType", "WeatherCelsius", "WeatherType", "DateProcessed", "DrivingStyleAcceleration", "DrivingStyleTotalWeightingFactor", "BulkInsertSessionId"];
opts.VariableTypes = ["double", "double", "double", "double", "double", "double", "double", "string", "double", "double", "double", "double", "double", "double", "double", "double", "double", "categorical", "double", "double", "double", "categorical", "double", "double", "string", "double", "double", "double", "double", "double", "double", "double", "double", "string", "double", "categorical", "datetime", "double", "double", "double"];
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";
opts = setvaropts(opts, ["EndDate", "FuelConsumptionExpectedLiter", "TrafficType"], "WhitespaceRule", "preserve");
opts = setvaropts(opts, ["EndDate", "StartDate", "VinNumber", "FuelConsumptionExpectedLiter", "TrafficType", "WeatherType"], "EmptyFieldRule", "auto");
opts = setvaropts(opts, "DateProcessed", "InputFormat", "yy-MM-dd");
opts = setvaropts(opts, "DriverIdentification", "TrimNonNumeric", true);
opts = setvaropts(opts, ["ID", "DrivingStyleCoastingDifficultyLevel", "DrivingStyleCruiseControl", "DrivingStyleCruiseControlDifficultyLevel", "DrivingStyleIdling", "DrivingStyleIdlingDifficultyLevel", "DrivingStyleTotalDifficultyLevel", "DrivingStyleCoasting", "Safety", "TotalTimeOverZero", "DrivingStyleTotal", "DrivingStyleAccelerationWeightingFactor", "DrivingStyleBreakingWeightingFactor", "DrivingStyleCoastingWeightingFactor", "DrivingStyleCruiseControlWeightingFactor", "DrivingStyleIdlingWeightingFactor", "DrivingStyleBreakingDifficultyLevel", "DrivingStyleBreaking", "DrivingStyleAccelerationDifficultyLevel", "DriverIdentification", "FuelConsumptionLiter", "FuelConsumptionAverage", "FuelSavedLiter", "FuelSavedCo2", "FuelSavedCurrency", "DistanceKm", "AverageSpeedKmHour", "EstimatedWeight", "ApiWebserviceId", "WeatherCelsius", "DrivingStyleAcceleration", "DrivingStyleTotalWeightingFactor", "BulkInsertSessionId"], "DecimalSeparator", ",");
opts = setvaropts(opts, "DriverIdentification", "ThousandsSeparator", ".");
scoretabel = readtable("/Users/diontheunissen/Downloads/score-tabel-20211130-1050.csv", opts);
t1 = datetime('09/11/2021 00:00');
t2 = datetime('29/11/2021 00:00');
scoretabel2 = scoretabel(S,:);