function DatiElabSnowLink = LastElab_bisSL(conn,NodoSnowLink,rSL,datainiSL,...
    tempoiniSL,IDcentralina,DTcatena,FileName)

NSnowLink = cell2mat(NodoSnowLink(:,2));
NodeType = 'Snow Link';
ii = 1; % contatore
col = 4; % contatore colonne
while ii <= rSL
    ini_col = col-3;
    nN = num2str(NSnowLink(ii,1));
    % Scarico di dati di spostamenti
    comando = ['select EventDate, EventTime, ZShift, Z from ElabDataView where EventDate = ''' ...
        datainiSL ''' and  EventTime >= ''' tempoiniSL ''' and UnitName = ''' IDcentralina ''' and ToolNameID = '''...
        DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
    curs = exec(conn,comando);
    curs = fetch(curs);
    DATnodoSLd = curs.Data;
    % Scarico di dati di spostamenti
    comando = ['select EventDate, EventTime, ZShift, Z from ElabDataView where EventDate > ''' ...
        datainiSL ''' and  UnitName = ''' IDcentralina ''' and ToolNameID = '''...
        DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
    curs = exec(conn,comando);
    curs = fetch(curs);
    DATnodoSL = curs.Data; 
    [~,c1] = size(DATnodoSL);
    [~,c2] = size(DATnodoSLd);
    if c1==c2
        DATnodoSL = [DATnodoSLd; DATnodoSL];
    elseif c1 < c2 % solo giorno di riferimento
        DATnodoSL = DATnodoSLd;
    end
    DatiElabSnowLink(:,ini_col:col) = DATnodoSL(:,:);
    col = col+4;
    ii = ii+1;
end

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