필터 지우기
필터 지우기

Another pathdef.m question

조회 수: 7 (최근 30일)
Stan Kruger
Stan Kruger 2015년 2월 6일
댓글: Stan Kruger 2015년 2월 9일
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.

답변 (1개)

Jan
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.
  댓글 수: 1
Stan Kruger
Stan Kruger 2015년 2월 9일
Hi Jan, thanks for the answer. I do agree that it is important to have a well defined default path, however, it seems even more important to be able to control what that default path is. It sounds like you are saying that this is not an option in my case. Since I lack the permissions to change this default pathdef.m the only real option is to make sure I always start matlab from the directory where I have created my own pathdef.m.
Is this accurate? Thanks very much.

댓글을 달려면 로그인하십시오.

카테고리

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