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());
Best Answer