How to remove a specific script/function from path?
24 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(2 个)
Sean de Wolski
2015-5-4
rmpath
pathtool
But you're best off either renaming your isdiag() or putting it into a package to avoid name conflicts.
0 个评论
Jan
2015-5-4
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Search Path 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!