% Funzione che approssima il dato alla quarta cifra decimale (decimi di
% millimetri)
function [Y_TLHRH,Z_TLHRH,Ylocal_TLHRH,Zlocal_TLHRH,TempDef_TLHRH,speed_TLHRH,...
    speed_local_TLHRH,acceleration_TLHRH,acceleration_local_TLHRH,AlfaX_TLHRH,...
    AlfaY_TLHRH] = approx_TLHRH(Y_TLHRH,Z_TLHRH,Ylocal_TLHRH,Zlocal_TLHRH,...
    TempDef_TLHRH,speed_TLHRH,speed_local_TLHRH,acceleration_TLHRH,...
    acceleration_local_TLHRH,AlfaX_TLHRH,AlfaY_TLHRH,FileName)

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

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

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

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

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

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

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

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

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

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

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

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

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