forked from datajoint/mym
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mymSetup.m
28 lines (24 loc) · 866 Bytes
/
mymSetup.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
function mymSetup()
% mymSetup()
% Adds mym directories to your path and verifies that mym is
% working correctly.
basePath = fileparts(mfilename('fullpath'));
mexPath = fullfile(basePath, 'distribution', mexext());
assert(logical(exist(mexPath, 'dir')), ...
['This distribution of mym does not include binaries for your ' ...
'platform. Please obtain the ' ...
'<a href="https://github.com/datajoint/mym">source code for mym</a> ' ...
'and compile the MEX file for your platform.'])
addpath(mexPath);
% Change into distribution directory to avoid calling
% mym.m which only contains documentation.
oldp = cd(fileparts(mexPath));
oldpRestore = onCleanup(@() cd(oldp));
% Try calling mym
try
mym()
disp 'mym is now ready for use.'
catch mym_err
disp 'mym was added to your path but did not execute correctly.'
rethrow(mym_err);
end