필터 지우기
필터 지우기

Matlab forgets userpath setting after crash

조회 수: 3 (최근 30일)
Csaba
Csaba 2022년 8월 25일
댓글: Star Strider 2022년 9월 26일
I have set a folder containing startup scripts to the userpath:
>> userpath(...path to my folder...)
It works just fine, until it doesn't. When sometimes Matlab crashes, the next time the userpath is empty and I have to set it again.
Can it be fixed?
  댓글 수: 1
Walter Roberson
Walter Roberson 2022년 8월 25일
Sometimes when MATLAB crashes, it corrupts something in prefdir()

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

답변 (1개)

Star Strider
Star Strider 2022년 8월 25일
Can it be fixed?
Probably. Use a startup file. Create it and then put it in the main ...\Documents\MATLAB directory.
  댓글 수: 2
Csaba
Csaba 2022년 9월 26일
Yes, well, I'd like to use a custom file path, and that's why I use `userpath`. But it is not stable.
Star Strider
Star Strider 2022년 9월 26일
I do something like this —
My_Dir = userpath;
My_Work_Dir = genpath(My_Dir);
addpath(My_Work_Dir, '-end');
It has changed slightly over time (mostly to reflect changes in MATLAB and how it does these operations in the last 25 years that I have been using it), however this approach has been remarkably stable. If I add a new directory in my MATLAB search path, I close MATLAB then re-start it. That automatically adds the new directory to my MATLAB search path, then and forever. (It has been so long since I have changed anything in my startup file that I have forgotten the details. It works, so further changes to it are unlikely unless MATLAB changes and my startup file needs to be changed to accommodate those changes. I believe I have only had to do that three times since I first wrote my startup file.)

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

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by