How to remove a specific script/function from path?

24 views (last 30 days)
I use to work with a function named isdiag(), but from R2014a, Matlab has that function as built-in which is causing name conflict. I have functions arranged in a structure and I access them from Google Driven on different machines with different versions of Matlab and hence I do not wanted to modify the structure by deleting the function. Can I remove the function from the path or deleting it is the only option?

Answers (2)

Sean de Wolski
Sean de Wolski on 4 May 2015
rmpath
pathtool
But you're best off either renaming your isdiag() or putting it into a package to avoid name conflicts.

Jan
Jan on 4 May 2015
For exactly this reason I use CamelCase or sulkingCamelCase in the names of my functions. Then future additions of built-in toolbox functions will not invalidate my code, because (only most!) Matlab functions use lowercase.
I let FEX: UniqueFuncNames check the uniqueness of names during the installation of my own toolboxes to control this problem.
If the collision appears already, it is the best idea to rename your function and change it in all your source code files. There are some functions in the FEX which assist you in finding the occurrences. This is another good reason to avoid eval in general, which could hide the function names too easily.

Categories

Find more on Search Path in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!