added *.m~ to .gitignore and created file neighborIndex2offset.m which will be a matlab function.