MATLAB Answers

0

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

Asked by Edisson Aldas on 7 Aug 2015
Latest activity Commented on by biber alex on 8 Feb 2018
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??

  2 Comments

Hi, I found this happened when I had a .m and .slx file with the same base name. When I renamed the .m file, I could run it again.
bad: my_model.m, my_model.slx good: my_model_parameters.m, my_model.slx

Sign in to comment.

2 Answers

Answer by James Tursa
on 7 Aug 2015
Edited by James Tursa
on 7 Aug 2015
 Accepted 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

  1 Comments

Sign in to comment.


Answer by Dan Po
on 18 Oct 2016

doesnt help me,the file name is not found.

  3 Comments

Please post a copy of the error message, showing which file it says is doing the shadowing.
sridevi engg.college, please post a complete copy of the error message.
basename is not the name of any routine used in MATLAB with any of the toolboxes I have. It is, however, the name of an OS-X and Linux executable that by standards convention should be at /usr/bin/basename . If you see a message about basename not being found, it is likely coming from outside MATLAB, such as a problem in starting up MATLAB itself due to the PATH environment variable being incorrect.
It is possible, though, that you could be executing MATLAB code that uses unix() or system() to try to invoke some shell commands that include basename and that is not being found, either due to PATH corruption or due to you being on MS Windows.

Sign in to comment.



Translated by