Is there a way to make MATLAB remind a developer or warn a user that several conflicting (same name) versions of specific function m-file exists in different directories currently present in the path? This would be useful for in large collaborative MATLAB projects.
Is there a way to make MATLAB remind a developer or warn a user
Share
If you have a specific function name you need to check to see if any functions with that name already exist, you can use the function WHICH. For example, if I add a new function file
test.mto my current directory (C:\Program Files\MATLAB\R2010b\bin\), then this is what WHICH tells me:There are now three functions called
test: one is a class method forclassregtreeobjects, one is the function I just made (top line), and the last (bottom line) is now shadowed by the one I just made. This would mean that, if I calledtestfrom my current directory, the first one would be called. If I change to another directory, I get this instead:The newer
testfunction doesn’t show up now, since the previous directory wasn’t saved on the MATLAB path. The previously shadowedtestfunction would now be the one called.