function DatiElabTunnelLink = LastElab_bisTuL(conn,NodoTunnelLink,rTuL,...
    datainiTuL,tempoiniTuL,IDcentralina,DTcatena,FileName)

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

NTunnelLink = cell2mat(NodoTunnelLink(:,2)); 
NodeType = 'Tunnel Link';
ii = 1; % contatore
col = 16; % contatore colonne
while ii <= rTuL
      ini_col = col-15;
     nN = num2str(NTunnelLink(ii,1));
     % Scarico di dati di spostamenti
     comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z, Xstar, Zstar, HShift, HShift_local, T_node, Area, speed_local, acceleration_local from ElabDataView where EventDate = ''' ...
         datainiTuL ''' and EventTime >= ''' tempoiniTuL ''' and  UnitName = ''' IDcentralina ''' and ToolNameID = '''...
         DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
     curs = exec(conn,comando);
     curs = fetch(curs);
     DATnodoTuLd = curs.Data;  
     % Scarico di dati di spostamenti
     comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z, Xstar, Zstar, HShift, HShift_local, T_node, Area, speed_local, acceleration_local from ElabDataView where EventDate > ''' ...
         datainiTuL ''' and  UnitName = ''' IDcentralina ''' and ToolNameID = '''...
         DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
     curs = exec(conn,comando);
     curs = fetch(curs);
     DATnodoTuL = curs.Data;  
     [~,c1] = size(DATnodoTuL);
     [~,c2] = size(DATnodoTuLd);
     if c1 == c2
         DATnodoTuL = [DATnodoTuLd; DATnodoTuL];
     elseif c1 < c2 % solo giorno di riferimento
         DATnodoTuL = DATnodoTuLd;
     end
     DatiElabTunnelLink(:,ini_col:col) = DATnodoTuL(:,:);              
     col = col+16;
     ii = ii+1;
end

text = 'LastElab_bisTuL function worked correctly for Tunnel Link';
fprintf(fileID,fmt,text);
fclose(fileID);
end