Another pathdef.m question
17 次查看(过去 30 天)
显示 更早的评论
I've seen this question asked multiple times, and have still not found a satisfactory answer.
I am running matlab from unix, and I do not have write permissions in the folder where matlab is kept. I want matlab to read and apply my custom path definitions as written in pathdef.m - I want this done automatically on startup. If I start matlab from my own data allocation, within the folder where I keep pathdef.m, there is no problem, matlab reads pathdef.m and all my paths are defined as I want. However, if I start matlab from anywhere else, matlab doesn't read pathdef.m, and I have to manually set the path. This is undesireable, I want pathdef.m to be read and applied no matter where I start matlab from.
I assume this same problem will occur if I customize a startup.m file as well, which is also undesireable. Can anybody assist me? Thanks.
0 个评论
回答(1 个)
Jan
2015-2-7
The pathdef.m included in Matlab's program path matlabroot is used, if there is no such file in the current directory, as you have observered. This is the wanted behavior, because the path should be defined properly as default.
In opposite to pathdef.m there is no startup.m file included in Matlab as default. Therefore the startup function is user-defined only. Therefore the startup function is the right location to include user-defined changes to the path.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!