function DatiElabRadialLink = LastElab_bisRL(conn,NodoRadialLink,rRL,...
    datainiRL,tempoiniRL,IDcentralina,DTcatena,FileName)

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

NRadialLink = cell2mat(NodoRadialLink(:,2)); 
NodeType = 'Radial Link';
ii = 1; % contatore
col = 9; % contatore colonne
while ii <= rRL
     ini_col = col-8;
     nN = num2str(NRadialLink(ii,1));
     % Scarico di dati di spostamenti
     comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z, T_node from ElabDataView where EventDate = ''' ...
         datainiRL ''' and EventTime >= ''' tempoiniRL ''' and  UnitName = ''' IDcentralina ''' and ToolNameID = '''...
         DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
     curs = exec(conn,comando);
     curs = fetch(curs);
     DATnodoRLd = curs.Data;
     % Scarico di dati di spostamenti
     comando = ['select EventDate, EventTime, XShift, YShift, ZShift, X, Y, Z, T_node from ElabDataView where EventDate > ''' ...
         datainiRL ''' and  UnitName = ''' IDcentralina ''' and ToolNameID = '''...
         DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
     curs = exec(conn,comando);
     curs = fetch(curs);
     DATnodoRL = curs.Data;
     [~,c1] = size(DATnodoRL);
     [~,c2] = size(DATnodoRLd);
     if c1 == c2
         DATnodoRL = [DATnodoRLd; DATnodoRL];
     elseif c1 < c2 % solo giorno di riferimento
         DATnodoRL = DATnodoRLd;
     end
     DatiElabRadialLink(:,ini_col:col) = DATnodoRL(:,:);              
     col = col+9;
     ii = ii+1;
end

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