-
Notifications
You must be signed in to change notification settings - Fork 45
/
spx_setup.m
37 lines (29 loc) · 1.28 KB
/
spx_setup.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
31
32
33
34
35
36
function [globals] = spx_setup()
% Let us get the full path of this file
globals.filepath = which(mfilename);
% Get the directory of this file
% This is the directory in which SparsePlex library is hosted.
globals.root = fileparts(globals.filepath);
% This is the directory where source-plex library code is hosted.
globals.spx = fullfile(globals.root, 'library');
addpath(globals.root);
addpath(globals.spx);
globals.ext = fullfile(globals.spx, 'ext');
addpath(globals.ext);
% support for spx_ini2struct function
addpath(fullfile(globals.ext, 'ini2struct'));
% support for export_fig
addpath(fullfile(globals.ext, 'export_fig'));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Following process is for getting the default settings
% for different data directories in local environment.
default_settings_path = fullfile(globals.root, 'spx_defaults.ini');
local_settings_path = fullfile(globals.root, 'spx_local.ini');
if ~exist(local_settings_path, 'file')
fprintf('Copying default settings file to local settings file.\n');
copyfile(default_settings_path, local_settings_path);
end
globals.local_settings = spx_ini2struct(local_settings_path);
spx_settings_cache = fullfile(globals.root, 'spx_local_settings.mat');
save(spx_settings_cache, 'globals');
end