% Funzione che approssima il dato alla quarta cifra decimale (decimi di
% millimetri)
function [X_HR,Y_HR,Z_HR,Xlocal_HR,Ylocal_HR,Zlocal_HR,HShift_HR,...
    HShift_local_HR,Azimuth_HR,Speed_HR,Speed_local_HR,Acceleration_HR,...
    Acceleration_local_HR,TempDef_TLHR] = approx_TLHR(X_HR,Y_HR,Z_HR,...
    Xlocal_HR,Ylocal_HR,Zlocal_HR,HShift_HR,HShift_local_HR,Azimuth_HR,...
    Speed_HR,Speed_local_HR,Acceleration_HR,Acceleration_local_HR,TempDef_TLHR,FileName)
        
conv = X_HR*1000000;
conv = round(conv);
X_HR = conv/1000000;

conv = Y_HR*1000000;
conv = round(conv);
Y_HR = conv/1000000;

conv = Z_HR*1000000;
conv = round(conv);
Z_HR = conv/1000000;

conv = Xlocal_HR*1000000;
conv = round(conv);
Xlocal_HR = conv/1000000;

conv = Ylocal_HR*1000000;
conv = round(conv);
Ylocal_HR = conv/1000000;

conv = Zlocal_HR*1000000;
conv = round(conv);
Zlocal_HR = conv/1000000;

conv = HShift_HR*1000000;
conv = round(conv);
HShift_HR = conv/1000000;

conv = HShift_local_HR*1000000;
conv = round(conv);
HShift_local_HR = conv/1000000;

conv = Azimuth_HR*10;
conv = round(conv);
Azimuth_HR = conv/10;

conv = Acceleration_local_HR*1000000;
conv = round(conv);
Acceleration_local_HR = conv/1000000;

conv = Speed_HR*1000000;
conv = round(conv);
Speed_HR = conv/1000000;

conv = Speed_local_HR*1000000;
conv = round(conv);
Speed_local_HR = conv/1000000;

conv = Acceleration_HR*1000000;
conv = round(conv);
Acceleration_HR = conv/1000000;

conv = TempDef_TLHR*10;
conv = round(conv);
TempDef_TLHR = conv/10;

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

end