MATLAB: Error: “MATLAB cannot run this file because c:\~~~ shadows it. delete shadowing file and try again”

MATLABshadowingsimulink

Hi I've a question about matlab simulink when I run a code, there are message
"MATLAB cannot run this file because c:\~~~ shadows it. delete shadowing file and try again"
what's the problem? And why this happen??

Best Answer

There is a pecking order of files to run when several files of the same base name are visible (i.e. in the current directory or on the path). E.g., if the current directory has a file named myfunction.m and myfunction.mexw32, MATLAB will run the latter because mex files are higher in the pecking order than m-files. You have a similar situation. You have more than one file with the same base name and because of different extensions or location one of them is shadowing (i.e. is higher in the pecking order than) the other. Examine the error message in detail to discover what the files are. You can also type this at the command line to discover all of the visible files with the same base name:
which basename -all
Related Question