-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmslice_off.m
30 lines (25 loc) · 976 Bytes
/
mslice_off.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function mslice_off
% Remove paths to all mslice root directory and all sub-directories.
%
% To remove mslice from the matlab path, type
% >> mslice_off
% T.G.Perring
%
% $Revision: 345 $ ($Date: 2017-09-27 15:50:53 +0100 (Wed, 27 Sep 2017) $)
%
% root directory is assumed to be that in which this function resides
rootpath = fileparts(which('mslice_off'));
% Close down mslice, if running
try
mslice_finish % sometimes this might not be on the path e.g. if mslice has not been initialised. Do not want mslice_off to fail.
catch
end
warn_state=warning('off','all'); % turn of warnings (so don't get errors if remove non-existent paths)
try
paths = genpath(rootpath);
rmpath(paths);
warning(warn_state); % return warnings to initial state
catch
warning(warn_state); % return warnings to initial state if error encountered
error('Problems removing "%s" and sub-directories from matlab path',rootpath)
end