function DatiElabInPlaceLink = LastElab_bisIPL(conn,NodoInPlaceLink,rIPL,...
    datainiIPL,tempoiniIPL,IDcentralina,DTcatena,FileName)

NInPlaceLink = cell2mat(NodoInPlaceLink(:,2));
NodeType = 'In Place Link';
ii = 1; % contatore
col = 16; % contatore colonne
while ii <= rIPL
    ini_col = col-15;
    nN = num2str(NInPlaceLink(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 = ''' ...
        datainiIPL ''' and EventTime >= ''' tempoiniIPL ''' and  UnitName = ''' IDcentralina ''' and ToolNameID = '''...
        DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
    curs = exec(conn,comando);
    curs = fetch(curs);
    DATnodoIPLd = 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 > ''' ...
        datainiIPL ''' and  UnitName = ''' IDcentralina ''' and ToolNameID = '''...
        DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
    curs = exec(conn,comando);
    curs = fetch(curs);
    DATnodoIPL = curs.Data;
    [~,c1] = size(DATnodoIPL);
    [~,c2] = size(DATnodoIPLd);
    if c1==c2
        DATnodoIPL = [DATnodoIPLd; DATnodoIPL];
    elseif c1 < c2 % solo giorno di riferimento
        DATnodoIPL = DATnodoIPLd;
    end
    DatiElabInPlaceLink(:,ini_col:col) = DATnodoIPL(:,:);
    col = col+16;
    ii = ii+1;
end

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