Skip to content

Commit 92375ca

Browse files
committed
add uninit function
1 parent 4516176 commit 92375ca

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

initCppRoi.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,25 @@
33
function initCppRoi()
44

55
global CPP_ROI_INITIALIZED
6+
global CPP_ROI_PATHS
67

78
if isempty(CPP_ROI_INITIALIZED)
89

910
% directory with this script becomes the current directory
10-
WD = fileparts(mfilename('fullpath'));
11+
thisDirectory = fileparts(mfilename('fullpath'));
1112

1213
% we add all the subfunctions that are in the sub directories
13-
addpath(genpath(fullfile(WD, 'src')));
14-
addpath(fullfile(WD, 'lib', 'marsbar-0.44'));
14+
CPP_ROI_PATHS = genpath(fullfile(thisDirectory, 'src'));
15+
CPP_ROI_PATHS = cat(2, CPP_ROI_PATHS, ':', ...
16+
fullfile(thisDirectory, 'lib', 'marsbar-0.44'));
17+
1518
marsbar('on');
1619
try
1720
marsbar('splash');
1821
catch
1922
end
2023

24+
addpath(CPP_ROI_PATHS, '-begin');
2125
CPP_ROI_INITIALIZED = true();
2226

2327
else

uninitCppRoi.m

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
% (C) Copyright 2021 CPP ROI developers
2+
3+
function uninitCppRoi()
4+
5+
global CPP_ROI_INITIALIZED
6+
global CPP_ROI_PATHS
7+
8+
if isempty(CPP_ROI_INITIALIZED) || ~CPP_ROI_INITIALIZED
9+
fprintf('\n\nCPP_ROI not initialized\n\n');
10+
return
11+
12+
else
13+
marsbar('off');
14+
rmpath(CPP_ROI_PATHS);
15+
CPP_ROI_INITIALIZED = false;
16+
17+
end
18+
19+
end
20+

0 commit comments

Comments
 (0)