path(pathdef) does not reset the matlab path

조회 수: 3 (최근 30일)
Joel Handy
Joel Handy 2019년 6월 3일
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에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by