Unfortunately this function does not compute the LBP correctly.
To fix it you need to change 'sign(currNieghDiff)' to 'currNieghDiff > 0'.
You should also change 'if nNeigh<=8' to 'if nNeigh<=9', as nNeigh = number of neighbours + 1.
Finally in the Primitive pixelwise solution you need to change
neighMat( ceil(nNeigh/2)+ 1 )=false;