필터 지우기
필터 지우기

How to remove a specific script/function from path?

조회 수: 14 (최근 30일)
Pankaj
Pankaj 2015년 5월 4일
답변: Jan 2015년 5월 4일
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?

답변 (2개)

Sean de Wolski
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.

Jan
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.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by