function [GI_AngoloKL,GI_NumKL,GI_DateKL,ATTIVA,FIG] = report_KL_ENG(rKL,m,...
    NodoKlinoLink,toolrif,unitrif,datarif,Font_caption,Font_tools,...
    siteID,DT,FIG,br,status,ATTIVA,conn,FileName)

import mlreportgen.dom.*
import mlreportgen.report.*

% Make sure DOM is compilable
makeDOMCompilable()

GI_AngoloKL = [];
GI_NumKL = [];
GI_DateKL = [];
NODATA(m,1) = 0;
check = 0;
while check == 0
    if status(m,1) == 1
        if ATTIVA == 1
            ATTIVA = 0;
            testo = Paragraph('Array not installed or inactive.');
            add(DT,testo);
        end
        check = 1;
    elseif status(m,1) == 3
        if ATTIVA == 1
            ATTIVA = 0;
            testo = Paragraph(['Monitoring completed. Please log into the web-based platoform '...
                'to access the complete dataset.']);
            add(DT,testo);
        end
        check = 1;
    else
        KE = Section();
        titolo = 1;
        for k = 1:rKL(m,1)
            NodeNum = num2str(NodoKlinoLink(k,m));
            comando = ['select EventDate, EventTime, XShift, YShift, T_node from ElabDataView where EventDate >= ''' ...
                datarif ''' and  ToolNameID = ''' char(toolrif) ''' and UnitName = ''' char(unitrif) ...
                ''' and NodeNum = ''' NodeNum ''' '];
            curs = exec(conn,comando);
            curs = fetch(curs);
            Dati = curs.Data;
            % Modifico il formato di data e ora
            [rD,rC] = size(Dati);
            if rC ~= 1
                T = [cell2mat(Dati(:,1)) repmat(' ', [rD,1]) cell2mat(Dati(:,2))];
                Date = datenum(T); % Data
                if k == 1 % Il primo lo scrivo e creo la variabile di controllo
                    check = 1;
                else
                    [rS,~] = size(TiltX(:,k-1));
                    if rD ~= rS
                        NODATA(m,1) = 2;
                        check = 0;
                        break
                    else
                        check = 1;
                    end
                end
                TiltX(:,k) = cell2mat(Dati(:,3)); % asse x
                TiltY(:,k) = cell2mat(Dati(:,4)); % asse y
                TempKL(:,k) = cell2mat(Dati(:,5)); % temperatura
            else
                NODATA(m,1) = 1;
                check = 1;
            end
            if NODATA(m,1) == 0
                % grafico inclinazione-tempo asse X,Y NELL'ULTIMO MESE
                figure(1)
                subplot(2,1,1); % (righe colonne posizione)
                pbaspect([3 1 1]);
                yyaxis left
                plot(Date,TiltX(:,k));
                if isnan(TempKL(:,k)) == 0
                    yyaxis right
                    hold on
                    plot(Date,TempKL,':','LineWidth',1.1);
                    yyaxis right
                    ylabel(['Temperature [' char(176) 'C]']);
                    set(gca,'YColor','k');
                end
                xlim([Date(1)-1 Date(end)+1]);
                title(['Tilt meter ' NodeNum ' - X axis tilt']);
                xlabel('Date [dd/mm/yyyy]');
                yyaxis left
                ylabel(['Tilt [' char(186) ']']);
                set(gca,'YColor','k');
                
                h = gca;
                h.XAxis.MinorTick = 'on';
                datetick('x','dd/mm/yyyy','keepticks','keeplimits');
                xtickangle(20);
                grid on
                grid minor
                
                hold off
                subplot(2,1,2)
                pbaspect([3 1 1]);
                yyaxis left
                InclY = plot(Date,TiltY(:,k));
                if isnan(TempKL) == 0
                    yyaxis right
                    hold on
                    TempKL_Y = plot(Date,TempKL(:,k),':','LineWidth',1.1);
                    yyaxis right
                    ylabel(['Temperature [' char(176) 'C]']);
                    set(gca,'YColor','k');
                end
                xlim([Date(1)-1 Date(end)+1]);
                title(['Tilt meter ' NodeNum ' - Y axis tilt']);
                xlabel('Date [dd/mm/yyyy]');
                yyaxis left
                ylabel(['Tilt [' char(186) ']']);
                set(gca,'YColor','k');
                h = gca;
                h.XAxis.MinorTick = 'on';
                datetick('x','dd/mm/yyyy','keepticks','keeplimits');
                xtickangle(20);
                grid on
                grid minor
                
                legendaKL = Image(which('legendaKL_ENG.png'));
                legendaKL.Style = {Height('0.5cm'),HAlign('center')};
                
                TempName = char(strcat('Report',siteID,'-', char(toolrif),'-Klino', NodeNum, '_ENG.png'));
                saveas(InclY,TempName);
                ChartKL = Image(TempName);
                ChartKL.Style = {ScaleToFit};
                ChartKL_cap = Paragraph(['Fig. ' num2str(FIG) ' - Tilt along X and Y instrumental axes '...
                    'recorded during the reference time period by 3D MEMS sensor installed on the tilt meter ' NodeNum ]);
                FIG = FIG+1;
                ChartKL_cap.Style = {HAlign('justify'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
                if titolo == 1
                    sezKlino = Heading3('Klino Link');
                    sezKlino.Style = {OuterMargin('0in','0in','0.15in','0in'),FontSize(Font_tools),Bold(1),Italic(1)};
                    KE.Title = sezKlino;
                    add(DT,sezKlino);
                    titolo = 0;
                end
                if k == 1
                    testo = Paragraph(['Following graphs report the tilt values measured during the reference time interval '...
                        'by the MEMS sensor installed on the node ' NodeNum ' along the two main instrumental axes X and Y.']);
                    testo.HAlign = 'justify';
                    add(DT,testo);
                end
                testo2 = Paragraph(['In the time period considered for this report, the tilt meter ' NodeNum ' recorded a maximum tilt value along '...
                    'the X axis equal to ' num2str(round(max(TiltX),2), '%0.2f') '' char(186) ' and a minimum value of '...
                    num2str(round(min(TiltX),2), '%0.2f') '' char(186) ', with '...
                    num2str(round(max(TiltX),2)-round(min(TiltX),2), '%0.2f')...
                    char(186) ' of maximum variation. For what concern the Y axis, maximum and minimum values are respectively equal to '...
                    num2str(round(max(TiltY),2), '%0.2f') '' char(186) ' and ' num2str(round(min(TiltY),2), '%0.2f')...
                    char(186) ', displaying a maximum variation of ' num2str(round(max(TiltY),2)-round(min(TiltY),2), '%0.2f')...
                    char(186) '.']);
                testo2.HAlign = 'justify';
                add(DT,testo2);
                add(DT,ChartKL);
                add(DT,legendaKL);
                add(DT,ChartKL_cap);
                add(DT,br);
                close(figure(1));
            else
                if ATTIVA == 1
                    testo = Paragraph('No data available for the reference time period.');
                    ATTIVA = 0;
                    add(DT,testo);
                    check = 1;
                end
            end
        end
        var1 = max(abs(TiltX-TiltX(1,:)));
        varX = max(var1);
        indX = find(var1 == varX);
        var2 = max(abs(TiltX-TiltX(1,:)));
        varY = max(var2);
        indY = find(var2 == varX);
        MAX = max(varX,varY);
        indM = find(max(varX,varY)==MAX);
        if indM == 1 % X
            GI_AngoloXKL = TiltX(:,indX)-TiltX(1,indX);
            GI_AngoloYKL = TiltY(:,indX)-TiltY(1,indX);
            GI_NumKL = NodoKlinoLink(indX,m);
            GI_DateKL = Date;
        else % Y
            GI_AngoloXKL = TiltX(:,indY)-TiltX(1,indY);
            GI_AngoloYKL = TiltY(:,indY)-TiltY(1,indY);
            GI_NumKL = NodoKlinoLink(indY,m);
            GI_DateKL = Date;
        end
    end
end
GI_AngoloKL(:,1) = GI_AngoloXKL;
GI_AngoloKL(:,2) = GI_AngoloYKL;

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

end