Update pos2dist.m