Binary To Gray Code Matlab, In MATLAB, try bwdist or something like that.