% Funzione che approssima il dato alla quarta cifra decimale (decimi di
% millimetri)
function [Y_TLH,Z_TLH,Ylocal_TLH,Zlocal_TLH,speed_TLH,speed_local_TLH,...
    acceleration_TLH,acceleration_local_TLH,TempDef_TLH] = approx_TLH(...
    Y_TLH,Z_TLH,Ylocal_TLH,Zlocal_TLH,speed_TLH,speed_local_TLH,...
    acceleration_TLH,acceleration_local_TLH,TempDef_TLH,FileName)

% Y
conv = Y_TLH*100000;
conv = round(conv);
Y_TLH = conv/100000;

% Y local
conv = Ylocal_TLH*100000;
conv = round(conv);
Ylocal_TLH = conv/100000;

% Z
conv = Z_TLH*100000;
conv = round(conv);
Z_TLH = conv/100000;

% Z local
conv = Zlocal_TLH*100000;
conv = round(conv);
Zlocal_TLH = conv/100000;

% Velocità
conv = speed_TLH*100000;
conv = round(conv);
speed_TLH = conv/100000;

% Velocità locale
conv = speed_local_TLH*100000;
conv = round(conv);
speed_local_TLH = conv/100000;

% Accelerazione
conv = acceleration_TLH*100000;
conv = round(conv);
acceleration_TLH = conv/100000;

% Accelerazione locale
conv = acceleration_local_TLH*100000;
conv = round(conv);
acceleration_local_TLH = conv/100000;

% TempDef
conv = TempDef_TLH*10;
conv = round(conv);
TempDef_TLH = conv/10;

text = 'approx_TLH function executed correctly';
fileID = fopen(FileName,'a');
fmt = '%s \r';
fprintf(fileID,fmt,text);
fclose(fileID);

end