Move the gray.m file out of the bin subdirectory in your MATLAB installation to some other directory on the MATLAB path and rename it. The reason naming it gray.m is a problem is that it shadows the built-in MATLAB function gray but does not behave the same way as gray does. So when some other function calls gray expecting to call the MATLAB function gray it is instead calling your gray.m.
Best Answer