MATLAB: When i convert image 2 grayscale, imshow doesn’t work. before use rgb2gray imshow worked. when run the fllg error displays: Attempt to execute SCRIPT gray as a function: E:\MATLAB\​R2013a\bin​\gray.m Error in imageDispl​ayValidate​Params (line 48)

error in imshowImage Processing Toolboxrgb2gray

pls help me ASAP

Best Answer

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.