pathdef.m, MATLAB upgrade, and Linux
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jason Nicholson
am 27 Feb. 2016
Beantwortet: Cam Salzberger
am 1 Mär. 2016
I use a custom pathdef.m on linux. When I upgrade my MATLAB, the pathdef.m file from the previous setup isn't correct anymore because pathdef.m contains both MATLAB system paths and my paths. This means my path breaks when I upgrade MATLAB or when I switch between versions but have one pathdef.m.
There has to be a better way to manage the path. If I just add my user paths to the default system paths in startup.m, this seems like this would work across different versions of MATLAB.
Is there a recommended way to handle the path across multiple versions of MATLAB?
Example startup.m for use across different matlab versions
% my custom path
p = ['/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/subtightplot:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/shortTimeFourierTransform:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/robustDifferentiators:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/RegularizeData3D:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/regexpBuilder/html:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/regexpBuilder:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/rainflow:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/quadlab-matlab-2.3:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/measuretool_1.13:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/hyp2f1mex:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/genetic:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/FMINSEARCHBND:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/figstate:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/20130227_xlwrite:', ...
'/home/jnicholson/Documents/MATLAB/UserDefinedFunctions/20130227_xlwrite/poi_library:'];
path(p, path());
0 Kommentare
Akzeptierte Antwort
Cam Salzberger
am 1 Mär. 2016
Hello Jason,
When a new version of MATLAB is installed, it will not try to get the old "pathdef" file out of the old version of MATLAB. What may have happened is that you have a "pathdef" file in your "userpath" directory. If there is another "pathdef" file that shadows the default file, then the other file will be used.
This is not the recommended practice. It is far safer to only have one "pathdef" file per installation, which contains only the default path that was installed with MATLAB. This is usually located in (matlabroot)/toolbox/local/.
Any user-defined directories may be added more safely from within a "startup" file, in the way you showed above. This is what I believe is the recommended practice. The difference between having the user-defined files in "startup" versus in "pathdef" should be nearly negligible in regards to MATLAB startup time, so don't worry about slowing everything down.
I hope this helps!
-Cam
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!