path(pathdef) does not reset the matlab path

7 views (last 30 days)
I know the question, "How do I restore the Matlab path to it's state at program start up," has been asked a million times and for some time I've been doing path(pathdef) as all of the answers suggest. Unfortunately I've started using the raspberry pi hardware support packange and found these support packages are not in pathdef.
doing some sluthing, I've found a script, presumably the script, that addes these packages to the path. Its only two lines of code, but they are fairly lengthy lines of code and they appear to be version dependant. They at least changed slightly between Matlab 2018b and 2019a. For the time being, I've written a script which will reset the path for me:
function [restoredPath] = resetPath()
%RESETPATH restores the matlab path to its state at startup
if verLessThan('matlab','9.6') %version prior to 2019a
pathFileName = '.ssiSearchFolders';
pathFileName = 'ssiSearchFolders';
pathFileLocation = fullfile( ...
matlabshared.supportpkg.internal.getSupportPackageRootNoCreate, ...
restoredPath = path;
I'm hoping that I have missed something and there is a much more direct method of reseting the path akin to simply path(pathdef).

Answers (0)


Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!