MATLAB Answers

Path not searching in current directory first

2 views (last 30 days)
David K
David K on 19 Nov 2020
On my path I have a folder called "Other_Code" which contains "@myClass/myClass.m". In the directory I am running from I have a file called "myClass.m" which overloads the one in the other folder. Since I am running the code from the same directory, MATLAB should search for the file in my current location first before moving onto the folders in my path. I am getting errors because the search path is somehow bypassing my current directory and accessing the folders in the path first. What's even more strange is that if I put a debug at the point that the function is called, I can use the command "which myClass", it returns the correct location of "currentDirectory/myClass.m". When I step through the code and get an error, the error info links me to the file "Other_code/@myClass/myClass.m".
Why is this happening, and how can I fix it?


Sign in to comment.

Answers (0)





Community Treasure Hunt

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

Start Hunting!