How to remove a specific script/function from path?

25 vues (au cours des 30 derniers jours)
Pankaj
Pankaj le 4 Mai 2015
Réponse apportée : Jan le 4 Mai 2015
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?

Réponses (2)

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

Jan
Jan le 4 Mai 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.

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by