/
setup.m
23 lines (18 loc) · 854 Bytes
/
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
% use C++ in the following
mex -setup C++;
% compile functions
mex -v CXXFLAGS='-O3 -std=c++11 -stdlib=libc++ -I./cMHRN -I./matlab' matlab/fast_mhrn.cpp matlab/CastResult.cpp cMHRN/mhrn.cpp cMHRN/Utilities.cpp
mex -v CXXFLAGS='-O3 -std=c++11 -stdlib=libc++ -I./cMHRN -I./matlab' matlab/kleinberg_network.cpp matlab/CastResult.cpp cMHRN/kleinberg.cpp cMHRN/Utilities.cpp
% move compiled functions to new folder
mkdir matlabbuild
movefile('fast_mhrn*','./matlabbuild');
movefile('kleinberg*','./matlabbuild');
% add path to matlab environment via startup-file in user directory
up = userpath;
startuppath = [up(1:end-1),'/startup.m'];
libpath = [pwd,'/matlabbuild'];
fid = fopen(startuppath, 'at'); % append to possibly existing startup-file
fprintf(fid,['\naddpath(''',libpath,''')\n']);
fclose(fid);
% add path for this session
addpath(libpath);