[23295] | 1 | %STARTUP - Matlab startup script
|
---|
| 2 | %
|
---|
| 3 | % startup.m is a script run by matlab at the beginning of a session, just
|
---|
| 4 | % before handing over the prompt to the user. This delivery startup.m script
|
---|
| 5 | % has been customized here for the ISSM code. This startup script should be
|
---|
| 6 | % run by users before trying to use ISSM. The best way to do that is to put
|
---|
| 7 | % the startup file in the location where Matlab starts and established its
|
---|
| 8 | % root directory.
|
---|
| 9 |
|
---|
| 10 | % clear the last warning to focus on the warnings of the ISSM path
|
---|
| 11 | lastwarn('');
|
---|
| 12 |
|
---|
| 13 | %Recover ISSM_TIER , or if on a Windows machine, ISSM_TIER_WIN
|
---|
| 14 | ISSM_TIER=getenv('ISSM_TIER_WIN');
|
---|
| 15 |
|
---|
| 16 | if (isempty(ISSM_TIER)),
|
---|
| 17 | error('issmdir error message: ''ISSM_TIER'' environment variable is empty! You should define ISSM_TIER in your .cshrc or .bashrc!');
|
---|
| 18 | end
|
---|
| 19 |
|
---|
| 20 | %Now add all issm code paths necessary to run issm smoothly.
|
---|
| 21 | %We capture the error output, so that we can warn the user to update
|
---|
| 22 | %the variable ISSM_TIER in this file, in case it is not correctly setup.
|
---|
| 23 |
|
---|
| 24 | %ISSM path
|
---|
| 25 | addpath(pwd); %add current path first
|
---|
| 26 | addpath([pwd '\bin']);
|
---|
| 27 | addpath([pwd '\lib']);
|
---|
| 28 |
|
---|
| 29 | %Check on any warning messages that might indicate that the paths were not correct.
|
---|
| 30 | if ~isempty(lastwarn),
|
---|
| 31 | fprintf('\n Error trying to setup ''ISSM'' code paths. Try and update the ISSM_TIER variable in your .cshrc or .bashrc!\n');
|
---|
| 32 | fprintf(' ''ISSM'' will not work at all until this is resolved\n\n');
|
---|
| 33 | else
|
---|
| 34 | fprintf('\n To get started with ISSM, type issmdoc at the command prompt.\n\n');
|
---|
| 35 | end
|
---|
| 36 |
|
---|
| 37 | %disable matlab bell!
|
---|
| 38 | beep off;
|
---|
| 39 |
|
---|
| 40 | % no warning if we try to plot while in nojvm (will not be supported in future releases)
|
---|
| 41 | warning off MATLAB:HandleGraphics:noJVM
|
---|
| 42 |
|
---|
| 43 | %at the end, get to tests directory if ISSM_TESTS exists:
|
---|
| 44 | ISSM_TESTS=getenv('ISSM_TESTS');
|
---|
| 45 | if ~isempty(ISSM_TESTS),
|
---|
| 46 | cd(ISSM_TESTS);
|
---|
| 47 | end
|
---|