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

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

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

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

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

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

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

% Accelerazione
conv = acceleration_local_TLH*10000;
conv = round(conv);
acceleration_local_TLH = conv/10000;

conv = acceleration_TLH*10000;
conv = round(conv);
acceleration_TLH = conv/10000;

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

conv = speed_TLH*10000;
conv = round(conv);
speed_TLH = conv/10000;

% Angoli
conv = AlfaY_TLH*10000;
conv = round(conv);
AlfaY_TLH = conv/10000;

conv = AlfaY_TLH*10000;
conv = round(conv);
AlfaY_TLH = conv/10000;

text = 'approx_TLH function executed correctly. approx_TLH function closed';
fprintf(fileID,fmt,text);
fclose(fileID);
end
