function [GI_MPB_RL,GI_MPB,GI_Base,GI_Date,FIG,FIG_ENG,battANALOG,ATTIVA] = report_MPBEL(DTcatena,...
    rMPBEL,m,NodoMultiPointExtensometerLink,toolrif,unitrif,contunit,datarif,...
    Font_caption,Font_tools,battANALOG,ATTIVA,siteID,DT,DT_ENG,FIG,FIG_ENG,br,...
    activeEN,status,conn,FileName)

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

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

% Make sure DOM is compilable
makeDOMCompilable()

GI_Date = [];
GI_MPB = [];
GI_Base = [];
GI_MPB_RL = [];
if status(m,1) == 1
    if ATTIVA == 1
        testo = Paragraph('GMUX non ancora installato o canale inattivo.');
        add(DT,testo);
        ATTIVA = 0;
        if activeEN == 1
            testo = Paragraph('GMUX not installed or inactive.');
            add(DT_ENG,testo);
        end
    end
elseif status(m,1) == 3
    if ATTIVA == 1
        testo = Paragraph(['Monitoraggio completato. Invitiamo a visitare la '...
            'piattaforma web per la visione dei dati storici.']);
        ATTIVA = 0;
        add(DT,testo);
        if activeEN == 1
            testo = Paragraph(['Monitoring completed. Please log into the web-based platform '...
                'to access the complete dataset.']);
            add(DT_ENG,testo);
        end
    end
else
    MPBE = Section();
    sezMPBELExtensometer = Heading3('MultiPoint Borehole Extensometer Link');
    sezMPBELExtensometer.Style = {OuterMargin('0in','0in','0.15in','0in'),FontSize(Font_tools),Bold(1),Italic(1)};
    MPBE.Title = sezMPBELExtensometer;
    
    if battANALOG == 0
        comando = ['select Date, Time, UnitName, ToolNameID, BatLevel, Temperature from RawDataView where Date >= ''' ...
            datarif ''' and UnitName = ''' char(unitrif) ''' and ToolNameID = '''...
            char(toolrif) ''' and NodeNum = 1 '];
        curs = exec(conn,comando);
        curs = fetch(curs);
        BatTemp = curs.Data;
        [~,cc] = size(BatTemp);
        
        if cc ~= 1 %ci sono dati riferiti all'ultimo mese/periodo di interesse
            DataPlot = [BatTemp(:,1) BatTemp(:,2)];
            % sistemo date, batteria e temperatura
            [rD,~] = size(DataPlot);
            T = [cell2mat(DataPlot(:,1)) repmat(' ', [rD,1]) cell2mat(DataPlot(:,2))];
            Date = datenum(T);
            Batteria = cell2mat(BatTemp(:,5));
            Temperatura = cell2mat(BatTemp(:,6));
            
            % testo introduttivo
            testoB1 = Paragraph(['I valori di tensione di alimentazione del GMUX durante il periodo '...
                'di monitoraggio sono riportati di seguito. Il corretto funzionamento del sistema '...
                char(232) ' assicurato per una carica superiore a 12 V. L''ultimo dato disponibile ' char(232) ' pari '...
                'a ' num2str(Batteria(end,1)) ' V.']);
            testoB2 = Paragraph(['Il GMUX integra al proprio interno un termometro '...
                'per monitorate la temperatura di esercizio ed identificare eventuali '...
                'anomalie. I dati di temperatura registrati sono riportati di seguito.']);
            testoB1.HAlign = 'justify';
            testoB2.HAlign = 'justify';
            
            % grafico batteria
            figure(19)
            plot(Date,Batteria);
            hold on
            title('Batteria e Temperatura del GMUX');
            xlabel('Data [gg/mm/aaaa]');
            ylabel('Livello di Batteria [V]');
            ylim([floor(min(Batteria(:,1))) ceil(max(Batteria(:,1)))]);
            
            yyaxis right
            GMUX = plot(Date,Temperatura,':','LineWidth',1.1);
            ylim([floor(min(Temperatura(:,1))) ceil(max(Temperatura(:,1)))]);
            ylabel(['Temperatura [' char(176) 'C]']);
            set(gca,'YColor','k');
            str(1,1) = cellstr('Batteria');
            str(2,1) = cellstr('Temperatura');
            legend(str,'Location','northwest');
            h = gca;
            h.XAxis.MinorTick = 'on';
            datetick('x','dd/mm/yyyy','keepticks','keeplimits');
            xtickangle(20);
            grid on
            grid minor
            xlim([Date(1)-1 Date(end)+1]);
            
            TempName = char(strcat('Report',siteID,'-', contunit,'-GMUX.png'));
            saveas(GMUX,TempName);
            ChartGMUX = Image(TempName);
            ChartGMUX.Style = {Height('8cm'),HAlign('center')};
            if Batteria(end,1) >= 12.5
                TempName = char(strcat('B_13.jpg'));
            elseif Batteria(end,1) >= 12
                TempName = char(strcat('B_12.jpg'));
            elseif Batteria(end,1) >= 11.3
                TempName = char(strcat('B_115.jpg'));
            elseif Batteria(end,1) >= 10.5
                TempName = char(strcat('B_11.jpg'));
            else
                TempName = char(strcat('B_10.jpg'));
            end
            Batt = Image(TempName);
            Batt.Style = {Height('4cm'),HAlign('center')};
            
            lot = Table({ChartGMUX, Batt});
            lot.TableEntriesStyle = {HAlign('center'),VAlign('middle')};
            lot.Style = {ResizeToFitContents(false),Width("100%")};
            grps(1) = TableColSpecGroup;
            grps(1).Span = 2;
            specs(1) = TableColSpec;
            specs(1).Span = 1;
            specs(1).Style = {Width("80%")};
            specs(2) = TableColSpec;
            specs(2).Span = 1;
            specs(2).Style = {Width("20%")};
            grps(1).ColSpecs = specs;
            lot.ColSpecGroups = grps;
            
            lot_cap = Paragraph(['Fig. ' num2str(FIG) ' - Livello di carica della batteria e temperatura del '...
                'GMUX durante il periodo di riferimento']);
            FIG = FIG+1;
            lot_cap.Style = {HAlign('center'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
            Batt = Section();
            sezBATT = Heading3('GMUX - Batteria e Temperatura');
            sezBATT.Style = {FontSize(Font_tools),Bold(1),Italic(1)};
            Batt.Title = sezBATT;
            add(DT,sezBATT);
            add(DT,testoB1);
            add(DT,testoB2);
            add(DT,lot);
            add(DT,lot_cap);
            add(DT,br);
            close(figure(19));
            
            %--ENG---
            if activeEN == 1
                MPBE_ENG = Section();
                sezMPBExt_ENG = Heading3('MultiPoint Borehole Extensometer Link');
                sezMPBExt_ENG.Style = {OuterMargin('0in','0in','0.15in','0in'),FontSize(Font_tools),Bold(1),Italic(1)};
                MPBE_ENG.Title = sezMPBExt_ENG;
                
                testoB1 = Paragraph(['The following chart reports the GMUX battery level trend recorded '...
                    'during the reference time period. '...
                    'The correct functioning of the data acquisition system is guaranteed for a '...
                    'minimum level of 12 V. The last available data is equal to ' num2str(Batteria(end,1)) ' V.']);
                testoB2 = Paragraph(['GMUX equips also a thermometer that allows the monitoring '...
                    'of the working temperature and the identification of eventual malfunctioning. The same '...
                    'chart displays also temperature data recorded by the multiplexer.']);
                testoB1.HAlign = 'justify';
                testoB2.HAlign = 'justify';
                
                % grafico batteria
                figure(19)
                plot(Date,Batteria);
                hold on
                title('GMUX battery level and temperature');
                xlabel('Date [dd/mm/yyyy]');
                ylabel('Battery Level [V]');
                ylim([floor(min(Batteria(:,1))) ceil(max(Batteria(:,1)))]);
                
                yyaxis right
                GMUX = plot(Date,Temperatura,':','LineWidth',1.1);
                ylim([floor(min(Temperatura(:,1))) ceil(max(Temperatura(:,1)))]);
                ylabel(['Temperature [' char(176) 'C]']);
                set(gca,'YColor','k');
                str(1,1) = cellstr('Battery');
                str(2,1) = cellstr('Temperature');
                legend(str,'Location','northwest');
                h = gca;
                h.XAxis.MinorTick = 'on';
                datetick('x','dd/mm/yyyy','keepticks','keeplimits');
                xtickangle(20);
                grid on
                grid minor
                xlim([Date(1)-1 Date(end)+1]);
                
                TempName = char(strcat('Report',siteID,'-', contunit,'-GMUX_ENG.png'));
                saveas(GMUX,TempName);
                ChartGMUX = Image(TempName);
                ChartGMUX.Style = {Height('8cm'),HAlign('center')};
                Batt = Image(TempNameB);
                Batt.Style = {Height('4cm'),HAlign('center')};
                
                lot = Table({ChartGMUX, Batt});
                lot.TableEntriesStyle = {HAlign('center'),VAlign('middle')};
                lot.Style = {ResizeToFitContents(false),Width("100%")};
                grps(1) = TableColSpecGroup;
                grps(1).Span = 2;
                specs(1) = TableColSpec;
                specs(1).Span = 1;
                specs(1).Style = {Width("80%")};
                specs(2) = TableColSpec;
                specs(2).Span = 1;
                specs(2).Style = {Width("20%")};
                grps(1).ColSpecs = specs;
                lot.ColSpecGroups = grps;
                
                lot_cap = Paragraph(['Fig. ' num2str(FIG_ENG) ' - Battery level and temperature recorded '...
                    'by the GMUX during the reference time period']);
                FIG_ENG = FIG_ENG+1;
                lot_cap.Style = {HAlign('center'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
                Batt_ENG = Section();
                sezBATT_ENG = Heading3('GMUX - Battery and temperature');
                sezBATT_ENG.Style = {FontSize(Font_tools),Bold(1),Italic(1)};
                Batt_ENG.Title = sezBATT_ENG;
                add(DT_ENG,sezBATT_ENG);
                add(DT_ENG,testoB1);
                add(DT_ENG,testoB2);
                add(DT_ENG,lot);
                add(DT_ENG,lot_cap);
                add(DT_ENG,br);
                close(figure(19));
            end          
            battANALOG = 1;
        end
    end
    
    add(DT,sezMPBELExtensometer);
    if activeEN == 1
          add(DT_ENG,sezMPBExt_ENG);  
    end
    
    for mp = 1:rMPBEL(m,1)
        NodeNum = num2str(NodoMultiPointExtensometerLink(mp,m));
        comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z 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 isnan(cell2mat(Dati(:,3))) == 0
                d1(:,mp) = cell2mat(Dati(:,3)); % deformazioni base 1
            else
                d1(:,mp) = 999999;
            end
            if isnan(cell2mat(Dati(:,4))) == 0
                d2(:,mp) = cell2mat(Dati(:,4)); % deformazioni base 2
            else
                d2(:,mp)  = 999999;
            end
            if isnan(cell2mat(Dati(:,5))) == 0
                d3(:,mp) = cell2mat(Dati(:,5)); % deformazioni base 3
            else
                d3(:,mp)  = 999999;
            end
            if isnan(cell2mat(Dati(:,6))) == 0
                d4(:,mp) = cell2mat(Dati(:,6)); % deformazioni base 4
            else
                d4(:,mp)  = 999999;
            end
            if isnan(cell2mat(Dati(:,7))) == 0
                d5(:,mp) = cell2mat(Dati(:,7)); % deformazioni base 5
            else
                d5(:,mp)  = 999999;
            end
            if isnan(cell2mat(Dati(:,8))) == 0
                d6(:,mp) = cell2mat(Dati(:,8)); % deformazioni base 6
            else
                d6(:,mp)  = 999999;
            end
                        
            % grafico deformazioni NELL'ULTIMO MESE
            figure(5);
            title(['Deformazioni misurate dal nodo numero ' NodeNum]);
            d1g(:,mp) = d1(:,mp)-d1(1,mp);
            MX(1) = max(d1g(:,mp));
            MN(1) = min(d1g(:,mp));
            MPB = plot(Date,d1g(:,mp));
            M = max(abs(d1g(:,mp)));
            S = find(abs(d1g(:,mp))==M(1));
            D = d1g(S(1),mp);
            basi = 1;
            if d2(1,mp) < 999999
                hold on
                d2g(:,mp) = d2(:,mp)-d2(1,mp);
                MX(2) = max(d2g(:,mp));
                MN(2) = min(d2g(:,mp));
                MPB = plot(Date,d2g(:,mp));
                M(2) = max(abs(d2g(:,mp)));
                S = find(abs(d2g(:,mp))==M(2));
                D(2) = d2g(S(1),mp);
                basi = 2;
            end
            if d3(1,mp) < 999999
                hold on
                d3g(:,mp) = d3(:,mp)-d3(1,mp);
                MX(3) = max(d3g(:,mp));
                MN(3) = min(d3g(:,mp));
                MPB = plot(Date,d3g(:,mp));
                M(3) = max(abs(d3g(:,mp)));
                S = find(abs(d3g(:,mp))==M(3));
                D(3) = d3g(S(1),mp);
                basi = 3;
            end
            if d4(1,mp) < 999999
                hold on
                d4g(:,mp) = d4(:,mp)-d4(1,mp);
                MX(4) = max(d4g(:,mp));
                MN(4) = min(d4g(:,mp));
                MPB = plot(Date,d4g(:,mp));
                M(4) = max(abs(d4g(:,mp)));
                S = find(abs(d4g(:,mp))==M(4));
                D(4) = d4g(S(1),mp);
                basi = 4;
            end
            if d5(1,mp) < 999999
                hold on
                d5g(:,mp) = d5(:,mp)-d5(1,mp);
                MX(5) = max(d5g(:,mp));
                MN(5) = min(d5g(:,mp));
                MPB = plot(Date,d5g(:,mp));
                M(5) = max(abs(d5g(:,mp)));
                S = find(abs(d5g(:,mp))==M(5));
                D(5) = d5g(S(1),mp);
                basi = 5;
            end
            if d6(1,mp) < 999999
                hold on
                d6g(:,mp) = d6(:,mp)-d6(1,mp);
                MX(6) = max(d6g(:,mp));
                MN(6) = min(d6g(:,mp));
                plot(Date,d6g(:,mp));
                M(6) = max(abs(d6g(:,mp)));
                S = find(abs(d6g(:,mp))==M(6));
                D(6) = d6g(S(1),mp);
                basi = 6;
            end
            title(['Deformazioni registrate - Nodo numero ' NodeNum]);
            ylabel('Deformazione [mm]');
            xlabel('Data [gg/mm/aaaa]');
            set(gca,'YColor','k');
            str(1,1) = cellstr('Base 1');
            if basi > 1
                str(2,1) = cellstr('Base 2');
            end
            if basi > 2
                str(3,1) = cellstr('Base 3');
            end
            if basi > 3
                str(4,1) = cellstr('Base 4');
            end
            if basi > 4
                str(5,1) = cellstr('Base 5');
            end
            if basi > 5
                str(6,1) = cellstr('Base 6');
            end
            VAR(1) = max(MX);
            VAR(2) = min(MN);
            MAX = max(abs(VAR));
            IN = find(abs(VAR)==MAX);
            if IN == 1 % Legenda sotto
                legend(str,'Location','southwest');
            else
                legend(str,'Location','northwest');
            end
            
            legend(str,'Location','northwest');
            xlim([Date(1)-1 Date(end)+1]);
            h = gca;
            h.XAxis.MinorTick = 'on';
            datetick('x','dd/mm/yyyy','keepticks','keeplimits');
            xtickangle(20);
            grid on
            grid minor
            
            TempName = char(strcat('Report',siteID,'-', char(toolrif),'-MPBEL', NodeNum, '.png'));
            saveas(MPB,TempName);
            ChartMPBEL = Image(TempName);
            ChartMPBEL.Style = {Height('7.3cm'),HAlign('center')};
            ChartMPBEL_cap = Paragraph(['Fig. ' num2str(FIG) ' - Deformazioni '...
                'misurate dall''estensimetro multibase, nodo numero ' NodeNum...
                ', nel periodo temporale di riferimento']);
            FIG = FIG+1;
            ChartMPBEL_cap.Style = {HAlign('center'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
            
            %--ENG--
            
            if activeEN == 1
                % grafico deformazioni NELL'ULTIMO MESE
                figure(15);
                title(['Deformations meassured by node ' NodeNum]);
                d1g(:,mp) = d1(:,mp)-d1(1,mp);
                MX(1) = max(d1g(:,mp));
                MN(1) = min(d1g(:,mp));
                MPB = plot(Date,d1g(:,mp));
                M = max(abs(d1g(:,mp)));
                S = find(abs(d1g(:,mp))==M(1));
                D = d1g(S(1),mp);
                basi = 1;
                if d2(1,mp) < 999999
                    hold on
                    d2g(:,mp) = d2(:,mp)-d2(1,mp);
                    MX(2) = max(d2g(:,mp));
                    MN(2) = min(d2g(:,mp));
                    MPB = plot(Date,d2g(:,mp));
                    M(2) = max(abs(d2g(:,mp)));
                    S = find(abs(d2g(:,mp))==M(2));
                    D(2) = d2g(S(1),mp);
                    basi = 2;
                end
                if d3(1,mp) < 999999
                    hold on
                    d3g(:,mp) = d3(:,mp)-d3(1,mp);
                    MX(3) = max(d3g(:,mp));
                    MN(3) = min(d3g(:,mp));
                    MPB = plot(Date,d3g(:,mp));
                    M(3) = max(abs(d3g(:,mp)));
                    S = find(abs(d3g(:,mp))==M(3));
                    D(3) = d3g(S(1),mp);
                    basi = 3;
                end
                if d4(1,mp) < 999999
                    hold on
                    d4g(:,mp) = d4(:,mp)-d4(1,mp);
                    MX(4) = max(d4g(:,mp));
                    MN(4) = min(d4g(:,mp));
                    MPB = plot(Date,d4g(:,mp));
                    M(4) = max(abs(d4g(:,mp)));
                    S = find(abs(d4g(:,mp))==M(4));
                    D(4) = d4g(S(1),mp);
                    basi = 4;
                end
                if d5(1,mp) < 999999
                    hold on
                    d5g(:,mp) = d5(:,mp)-d5(1,mp);
                    MX(5) = max(d5g(:,mp));
                    MN(5) = min(d5g(:,mp));
                    MPB = plot(Date,d5g(:,mp));
                    M(5) = max(abs(d5g(:,mp)));
                    S = find(abs(d5g(:,mp))==M(5));
                    D(5) = d5g(S(1),mp);
                    basi = 5;
                end
                if d6(1,mp) < 999999
                    hold on
                    d6g(:,mp) = d6(:,mp)-d6(1,mp);
                    MX(6) = max(d6g(:,mp));
                    MN(6) = min(d6g(:,mp));
                    plot(Date,d6g(:,mp));
                    M(6) = max(abs(d6g(:,mp)));
                    S = find(abs(d6g(:,mp))==M(6));
                    D(6) = d6g(S(1),mp);
                    basi = 6;
                end
                title(['Deformations - Node ' NodeNum]);
                ylabel('Deformations [mm]');
                xlabel('Date [dd/mm/yyyy]');
                set(gca,'YColor','k');
                str(1,1) = cellstr('Base 1');
                if basi > 1
                    str(2,1) = cellstr('Rod 2');
                end
                if basi > 2
                    str(3,1) = cellstr('Rod 3');
                end
                if basi > 3
                    str(4,1) = cellstr('Rod 4');
                end
                if basi > 4
                    str(5,1) = cellstr('Rod 5');
                end
                if basi > 5
                    str(6,1) = cellstr('Rod 6');
                end
                VAR(1) = max(MX);
                VAR(2) = min(MN);
                MAX = max(abs(VAR));
                IN = find(abs(VAR)==MAX);
                if IN == 1 % Legenda sotto
                    legend(str,'Location','southwest');
                else
                    legend(str,'Location','northwest');
                end
                
                legend(str,'Location','northwest');
                xlim([Date(1)-1 Date(end)+1]);
                h = gca;
                h.XAxis.MinorTick = 'on';
                datetick('x','dd/mm/yyyy','keepticks','keeplimits');
                xtickangle(20);
                grid on
                grid minor
                
                TempName = char(strcat('Report',siteID,'-', char(toolrif),'-MPBEL', NodeNum, '_ENG.png'));
                saveas(MPB,TempName);
                ChartMPBEL_ENG = Image(TempName);
                ChartMPBEL_ENG.Style = {Height('7.3cm'),HAlign('center')};
                ChartMPBEL_ENG_cap = Paragraph(['Fig. ' num2str(FIG_ENG) ' - Deformations '...
                    'measured by the multipoint extensometer ' NodeNum...
                    ' during the reference time period']);
                FIG_ENG = FIG_ENG+1;
                ChartMPBEL_ENG_cap.Style = {HAlign('center'),FontSize(Font_caption),Italic(1),Color('midnightblue')};
            end
            
            MAX = max(M);
            IN = find(MAX==M); % Base che ha misurato tale variazione
            Massimo = D(IN); % Valore massimo (positivo o negativo) di deformazione misurata
            
            % Cerco eventuali correlazioni con Rad Array
            NomeFile = strcat('Report',siteID,'-RLvsMPBEL.txt');
            Filetesto = importdata(NomeFile);
            [rF,~] = size(Filetesto);
            AAA = 1;
            Nodo = 999;
            iNodo = 1;
            while AAA <= rF % Cerco la coppia di sensori Rad - Multibase da correlare
                check1 = Filetesto(AAA,1);
                if check1 == 99999 % Non ci sono multibase o non ci sono Rad
                   AAA = 2;
                else
                    check2 = Filetesto(AAA+1,1);
                    if check1 == str2num(DTcatena(end-2:end)) % Il Multibase è da prendere in considerazione ed è riportato nella prima riga del file
                       Nodo(iNodo) = Filetesto(AAA+2,1);
                       iNodo = iNodo+1;
                    elseif check2 == str2num(DTcatena(end-2:end)) % Il Multibase è da prendere in considerazione ed è riportato nella seconda riga del file
                           Nodo(iNodo) = Filetesto(AAA+3,1);
                           iNodo = iNodo+1;
                    end
                    AAA = AAA+4;
                end
            end
            [~,cd] = size(d1g);
            if IN == 1
                if Nodo(mp) <= cd
                    GI_MPB_RL(:,mp) = d1g(:,Nodo(mp));
                end
                GI_MPB(:,mp) = d1g(:,mp);
            elseif IN == 2
                if Nodo(mp) <= cd
                    GI_MPB_RL(:,mp) = d2g(:,Nodo(mp));
                end
                GI_MPB(:,mp) = d2g(:,mp);
            elseif IN == 3
                if Nodo(mp) <= cd
                    GI_MPB_RL(:,mp) = d3g(:,Nodo(mp));
                end
                GI_MPB(:,mp) = d3g(:,mp);
            elseif IN == 4
                if Nodo(mp) <= cd
                    GI_MPB_RL(:,mp) = d4g(:,Nodo(mp));
                end
                GI_MPB(:,mp) = d4g(:,mp);
            elseif IN == 5
                if Nodo(mp) <= cd
                    GI_MPB_RL(:,mp) = d5g(:,Nodo(mp));
                end
                GI_MPB(:,mp) = d5g(:,mp);
            elseif IN == 2
                if Nodo(mp) <= cd
                    GI_MPB_RL(:,mp) = d6g(:,Nodo(mp));
                end
                GI_MPB(:,mp) = d6g(:,mp);
            else
                
            end
            GI_Base(:,mp) = IN;
            GI_Date(:,mp) = Date;
                        
            testo = Paragraph(['Nei grafici seguenti sono rappresentati i dati relativi '...
                'alle deformazioni registrate dagli estensimetri multibase collegati all''Analog Array.']);
            testo2 = Paragraph(['Durante il periodo temporale di riferimento, il nodo numero ' NodeNum...
                ' ' char(232) ' stato caratterizzato da un valore massimo di deformazione differenziale pari a '...
                num2str(round(Massimo,2), '%0.2f') ' mm, rilevato dalla base numero ' num2str(IN) '. ']);
            testo.HAlign = 'justify';
            testo2.HAlign = 'justify';
            if mp == 1
                add(DT,testo);
            end
            add(DT,testo2);
            add(DT,ChartMPBEL);
            add(DT,ChartMPBEL_cap);
            if mp == rMPBEL(m,1)
                add(DT,br);
            end
            close(figure(5));
            
            %--ENG--
            
            if activeEN == 1
                testo = Paragraph(['The following graphs present deformations data '...
                    'recorded by multipoint borehole extensometers integrated in the Analog Array.']);
                testo2 = Paragraph(['During the reference time period, node' NodeNum...
                    ' measured a maximum differential deformation value of '...
                    num2str(round(Massimo,2), '%0.2f') ' mm, referred to Rod ' num2str(IN) '. ']);
                testo.HAlign = 'justify';
                testo2.HAlign = 'justify';
                if mp == 1
                    add(DT_ENG,testo);
                end
                add(DT_ENG,testo2);
                add(DT_ENG,ChartMPBEL_ENG);
                add(DT,ChartMPBEL_ENG_cap);
                if mp == rMPBEL(m,1)
                    add(DT_ENG,br);
                end
                close(figure(15));
            end
            %pulisco variabili da riutilizzare per catena successiva
        else
            if ATTIVA == 1
                testo = Paragraph('Non sono presenti dati relativi al periodo temporale considerato.');
                ATTIVA = 0;
                add(DT,testo);
                if activeEN == 1
                    testo = Paragraph('No data available for the reference time period.');
                    add(DT_ENG,testo);
                end
            end
        end
    end
end

text = 'report_MPBEL function executed correctly';
fprintf(fileID,fmt,text);
fclose(fileID);

end