function DatiElabInPlaceLinkHR = LastElab_bisIPLHR(conn,NodoInPlaceLinkHR,rIPLHR,...
    datainiIPLHR,tempoiniIPLHR,IDcentralina,DTcatena,FileName)

NInPlaceLinkHR = cell2mat(NodoInPlaceLinkHR(:,2));
NodeType = 'In Place Link HR';
ii = 1; % contatore
col = 16; % contatore colonne
while ii <= rIPLHR
    ini_col = col-15;
    nN = num2str(NInPlaceLinkHR(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 = ''' ...
        datainiIPLHR ''' and EventTime >= ''' tempoiniIPLHR ''' and  UnitName = ''' IDcentralina ''' and ToolNameID = '''...
        DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
    curs = exec(conn,comando);
    curs = fetch(curs);
    DATnodoIPLHRd = 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 > ''' ...
        datainiIPLHR ''' and  UnitName = ''' IDcentralina ''' and ToolNameID = '''...
        DTcatena ''' and NodeType = ''' NodeType ''' and NodeNum = ''' nN ''' '];
    curs = exec(conn,comando);
    curs = fetch(curs);
    DATnodoIPLHR = curs.Data;
    [~,c1] = size(DATnodoIPLHR);
    [~,c2] = size(DATnodoIPLHRd);
    if c1==c2
        DATnodoIPLHR = [DATnodoIPLHRd; DATnodoIPLHR];
    elseif c1 < c2 % solo giorno di riferimento
        DATnodoIPLHR = DATnodoIPLHRd;
    end
    DatiElabInPlaceLinkHR(:,ini_col:col) = DATnodoIPLHR(:,:);
    col = col+16;
    ii = ii+1;
end

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