function DatiElabTiltLink = LastElab_bisTL(conn,NodoTiltLink,rTL,datainiTL,...
    tempoiniTL,IDcentralina,DTcatena,FileName)

NTiltLink = cell2mat(NodoTiltLink(:,2));
NodeType = 'Tilt Link';
ii = 1; % contatore
col = 16; % contatore colonne
while ii <= rTL
    ini_col = col-15;
    nN = num2str(NTiltLink(ii,1));
    % Scarico di dati di spostamenti
    comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z, HShift, HShift_local, HShiftDir, T_node, speed, speed_local, acceleration, acceleration_local from ElabDataView where EventDate = ''' ...
        datainiTL ''' and EventTime >= ''' tempoiniTL ''' and  UnitName = ''' IDcentralina ''' and ToolNameID = '''...
        DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
    curs = exec(conn,comando);
    curs = fetch(curs);
    DATnodoTLd = curs.Data;
    % Scarico di dati di spostamenti
    comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z, HShift, HShift_local, HShiftDir, T_node, speed, speed_local, acceleration, acceleration_local from ElabDataView where EventDate > ''' ...
        datainiTL ''' and  UnitName = ''' IDcentralina ''' and ToolNameID = '''...
        DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
    curs = exec(conn,comando);
    curs = fetch(curs);
    DATnodoTL = curs.Data;
    [~,c1] = size(DATnodoTL);
    [~,c2] = size(DATnodoTLd);
    if c1==c2
        DATnodoTL = [DATnodoTLd; DATnodoTL];
    elseif c1 < c2 % solo giorno di riferimento
           DATnodoTL = DATnodoTLd;
    end
    DatiElabTiltLink(:,ini_col:col) = DATnodoTL(:,:);
    col = col+16;
    ii = ii+1;
end

text = 'LastElab_bisTL function worked correctly for Tilt Link V';
fileID = fopen(FileName,'a');
fmt = '%s \r';
fprintf(fileID,fmt,text);
fclose(fileID);
end