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

535 ビュー (過去 30 日間)
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??
  5 件のコメント
Giulia Panico
Giulia Panico 2021 年 1 月 8 日
I had the same problem. Thanks!
Alexander Wallberg
Alexander Wallberg 2021 年 3 月 2 日
Same problem here! Thanks!

サインインしてコメントする。

採用された回答

James Tursa
James Tursa 2015 年 8 月 7 日
編集済み: James Tursa 2015 年 8 月 7 日
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

その他の回答 (3 件)

Godspower
Godspower 2023 年 9 月 24 日
Rename the file name. that is, don't use the same mfile name with the slx file
  1 件のコメント
Manikandan
Manikandan 2024 年 3 月 30 日
Thank you for the solution.
I have renamed the files. But each time when i open simulink the links for constants are broken. So i have to go to mscript to run the code and save the parameters in workspace and then come back to simulink to run the sumulation. then it works fine.
Is this the same everytime? Appreciate your reply.

サインインしてコメントする。


Dan Po
Dan Po 2016 年 10 月 18 日
doesnt help me,the file name is not found.
  4 件のコメント
Walter Roberson
Walter Roberson 2017 年 3 月 8 日
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.
Walter Roberson
Walter Roberson 2024 年 11 月 13 日 21:20
When @James Tursa posted in 2015,
which basename -all
he did not mean basename literally; he meant that you were to fill in the basic name of what you were searching for. For example,
which myfunction -all
which might potentially return back listings for myfunction.m and myfunction.mexw64

サインインしてコメントする。


Jaydatta
Jaydatta 2024 年 11 月 13 日 8:02
編集済み: Jaydatta 2024 年 11 月 17 日 6:10
Hello ,
I faced same problem ,but what I did to resolve is ! keep file name for the code(Script) and model different.

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by