function [Xi,Zi,Yi,XiStar,ZiStar,YiStar] = corrTuL(indiceX,indiceZ,Xi,Zi,Yi,...
    XiStar,ZiStar,YiStar,ii,rTuL,FileName)
 
fileID = fopen(FileName,'a');
fmt = '%s \r';
            
[rIx,~] = size(indiceX);
if rIx > 0
   for bb = 1:rIx
        if ii == indiceX(bb)
            Xi = -1*Xi;
            text = ['Tunnel Link node number ' num2str(ii) ' corrected with '...
                'sign inversion along X-axes during the execution of corrTuL function'];
            fprintf(fileID,fmt,text);
        end
        if ii == (rTuL - indiceX(bb) +1)
            XiStar = -1*XiStar;
        end
   end
end
  
[rIz,~] = size(indiceZ);
if rIz > 0
   for bb = 1:rIz
        if ii == indiceZ(bb)
            Zi = -1*Zi;
            Yi = -1*Yi;
            text = ['Tunnel Link node number ' num2str(ii) ' corrected with '...
                'signs inversion along Y and Z axis during the execution of corrTuL function'];
            fprintf(fileID,fmt,text);
        end
        if ii == (rTuL - indiceZ(bb) +1)
            ZiStar = -1*ZiStar;
            YiStar = -1*YiStar;
        end
   end
end

fclose(fileID);

end