Functions name duplication in toolbox
이전 댓글 표시
Hi,
I have a problem with function name duplication.
I am using a toolbox in which i have a function called "kmeans" ( a name that i dont want to change because it will lead to problems with other functions im working with), but there is a part in my program where i want to use matlab's implementation for the kmeans algorithem (https://www.mathworks.com/help/stats/kmeans.html#buefs04-X)
Is there any option to "sign" my program that i dont want to use the toolbox's kmeans but with the matlab's one?
Thanks
댓글 수: 4
Deepak Gupta
2021년 10월 27일
You can try these answers:
https://www.mathworks.com/matlabcentral/answers/3167-two-functions-with-the-same-name-how-to-directly-call-one-of-both
Orr Streicher
2021년 10월 27일
Bjorn Gustavsson
2021년 10월 27일
Why on Earth would you explicitly want to stick with a function-name that is the same as a built-in function - if your function is not some kind of fall-back option for users without the toolbox that supplies that Mathworks-supplied function?
Orr Streicher
2021년 10월 27일
답변 (1개)
What about using builtin('kmeans') to call the Matlab version? [EDITED: This does not work. Thanks, Steven Lord]
Did you add your toolbox folders on top of Matlab's folders in the path? This is a bad idea.
댓글 수: 1
kmeans is not a built-in function suitable for use with the builtin function. It is a MATLAB function file included as part of Statistics and Machine Learning Toolbox.
which kmeans
builtin('kmeans', magic(10), 5)
카테고리
도움말 센터 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!