Path setting for a machine when upgrading MATLAB
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 15 Aug. 2022
Beantwortet: MathWorks Support Team
am 14 Nov. 2022
I have a number of machines which all need some folders on my path. We frequently set up new users or upgrade versions, and so we need to manually set the path each time we do this. The files needed in these paths include M-Files to use hardware as well as other "custom toolboxes".
Is there any methodology that can automatically set the path after upgrading MATLAB or adding a new user, rather than setting path manually?
Here are several suggestions I have for current situation. I would propose that the matlabrc file (or some other files) run a special startup m-file that it can find in a standard place on that machine. Perhaps the file could be located in "C:\Program Files\MATLAB" on Windows and "/Library/Application Support/MathWorks" on macOS. (Not sure about Linux.) This special startup file could add folders to the path (and maybe other things). Both upgrading MATLAB and adding a new user to the group could be done without having to do anything special.
Akzeptierte Antwort
MathWorks Support Team
am 15 Aug. 2022
Regarding to upgrading MATLAB, unfortunately MATLAB cannot automatically transfer path folders from an old version of MATLAB to a new one. We acknowledge this inconvenience and we are working to improve that. But for now, we provide two recommendations to add path.
Please see the following options.
1. Use "addpath" in "matlabrc" to add the folders on the path during MATLAB startup. The following link includes the documentation of command “addpath”.
The "matlabrc" is a script executed by MATLAB during startup regardless of the logged in users. Thus, all users will be able to have the folders on path after launching the MATLAB. For more details, please check the "matlabrc" documentation below:
2. Alternatively, add the folders to the path and save it to the default "pathdef.m" (located at $matlabroot/toolbox/local/pathdef.m). This can be done using the "savepath" command without any parameter. The documentation of "savepath" command can be found using the link below:
Before that, make sure “matlabroot/toolbox/local/pathdef.m” is the first “pathdef.m” on the path. This can be verified using following command:
>>which pathdef -all
The default “pathdef.m” will be used when there is no other “pathdef.m” (saved by user) found on the path. Thus, new users will be able to have the folders on path after launching the MATLAB. For more details, please check the "savepath" documentation.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!