-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAirQuantAddPath.m
45 lines (37 loc) · 1.5 KB
/
AirQuantAddPath.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
37
38
39
40
41
42
43
44
45
function varargout = AirQuantAddPath(AirQuantDirIn)
% Add AirQuant's directories to the MATLAB path so that its libraries can be used.
% Optional input argument to the directory that user may prefer to store
% data and save outputs.
% AirQuantDir out argument is the directory configured for Input/Output
% See <a href = "https://airquant.readthedocs.io/">AirQuant Documentation</a> for help.'
disp('See <a href = "https://airquant.readthedocs.io/">AirQuant Documentation</a> for help.')
% check if required toolboxes are installed
required_packages = {'Signal Processing Toolbox', 'Image Processing Toolbox', ...
'Statistics and Machine Learning Toolbox', 'Curve Fitting Toolbox',...
'Parallel Computing Toolbox'};
for apackage = required_packages
if contains(AQstruct2array(ver), apackage) == 0
warning(strcat(apackage{1},' is not installed, some features may not work properly.'))
end
end
% get path to airquant library directory and add to matlab path
[AirQuantDirLib,~,~] = fileparts(which('AirQuantAddPath'));
addpath(genpath(AirQuantDirLib))
if nargin < 1
% use default path if no argument
AirQuantDir = AirQuantDirLib;
else
% if data stored outside of airquant directory, add its path to matlab
addpath(genpath(AirQuantDirIn))
AirQuantDir = AirQuantDirIn;
end
if nargout > 0
varargout{1} = AirQuantDir
end
% configure expected paths for AirQuant
results_dir = fullfile(AirQuantDir, 'results');
% make results directory
if ~isfolder(results_dir)
mkdir(results_dir)
end
end