MATLAB cannot run this file because /Users/... shadows it in the current working folder.

98 Ansichten (letzte 30 Tage)
I am getting the above error when I try to run a script (that works perfectly well on Windows and was written in OS X, mind you) in MATLAB after selecting the folder in which the script is kept as the MATLAB path. I don't know why this is causing trouble (I'm running the code on 10.10.5). What's the issue? I do not understand.

Antworten (1)

Walter Roberson
Walter Roberson am 13 Jul. 2016
You have one of two cases (I would need to see the full message to decide which):
1) You are trying to run a script or function that is in a different directory, but your current directory has a script or function of the same name. The default MATLAB path automatically uses the current directory as the highest priority when it needs to search outside a file. You would need to rename the one in the current directory or you would need to cd to the other directory to run the other one; OR
2) You are trying to run a script or function in the current directory, but your MATLAB path has been set unusually to give priority to a different directory that also has a script or function of the same name. You would need to rename the one in the other directory or you would need to fix your MATLAB path. This situation is less common than the above, but can happen if you make direct assignments to a variable named path (or if you use addpath() with unusual options.)
  1 Kommentar
David Strickland
David Strickland am 13 Jul. 2016
Thanks for the response Walter. I have managed to "bypass" this error by simply reopening the respective script file. I was working in the directory where the file was located so the first case was not the issue.
The only thing I can think of is that when downloading these scripts they were automatically saved to my Downloads folder under the same name and that may've caused an issue (although I never did alter the MATLAB path priority).
Thanks again!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by