Another pathdef.m question
7 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Jan
on 7 Feb 2015
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.
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!