MATLAB Answers

Pankaj
1

How to remove a specific script/function from path?

Asked by Pankaj
on 4 May 2015
Latest activity Answered by Jan
on 4 May 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?

  0 Comments

Sign in to comment.

2 Answers

Answer by 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.

  0 Comments

Sign in to comment.


Answer by 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.

  0 Comments

Sign in to comment.