Conventional / "best practices" location for personal functions
조회 수: 3 (최근 30일)
이전 댓글 표시
Is there a conventional / standard / "best practices" location for parking self-developed functions, such that they are globally available from the command prompt (i.e. independent of current working directory)? I initially thought about $MATLABROOT/toolbox/local, but that contains exclusively TMW-provided scripts and text files. Moreover, as explained by John D'Errico in this old thread, there are potential issues with path caching at startup for anything placed inside $MATLABROOT.
(To be clear, I'm interested in where, rather than how. Either path or pathtool can be used to do the latter.)
댓글 수: 5
Stephen23
2020년 5월 22일
편집: Stephen23
2020년 5월 22일
@AMM: you should not add/remove/edit files within any application's installation directories. This is not just because of function caching issues (i.e. something specific to MATLAB), but because it is inherently a bad idea to alter anything in the installation directory of any application, even in locations that you think are benign, e.g. MATLAB's toolboxes.
https://www.mathworks.com/matlabcentral/answers/222839-how-to-use-functions-from-private-directories
There be dragons!
채택된 답변
Image Analyst
2020년 5월 22일
I do just like dpb says. The Mathworks told me to have a work folder, and all my various 200+ projects have subfolders under work. In addition, I have one folder there called Utilities that has a bunch of useful functions that I use all the time in other programs. I set a path to it in my startup.m file.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Adding custom doc에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!