path(pathdef) does not reset the matlab path

2 次查看(过去 30 天)
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
path(pathdef)
if verLessThan('matlab','9.6') %version prior to 2019a
pathFileName = '.ssiSearchFolders';
else
pathFileName = 'ssiSearchFolders';
end
pathFileLocation = fullfile( ...
matlabshared.supportpkg.internal.getSupportPackageRootNoCreate, ...
pathFileName);
matlab.internal.addons.addFoldersToPathFrom(pathFileLocation);
restoredPath = path;
end
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).

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by