startmachine.m 1.98 KB
Newer Older
1
function startmachine(rootpath)
2
global APPHOME MACHFS
3 4

if ~(exist('isdeployed','builtin') && isdeployed)
5
    
6
    if nargin < 1, rootpath=pwd; end
7
    optpath(...             % Same order as in the resulting PATH
8
        '~/matlab',...      % private matlab folder first in path
Simone Liuzzo's avatar
Simone Liuzzo committed
9 10 11
        fullfile(rootpath,'../tango-matlab/tango-matlab/mex-file'),...  % expects to find tango matlab in the parent directory
        fullfile(rootpath,'../tango-matlab/tango-matlab/m-files'),...  % expects to find tango matlab in the parent directory
        fullfile(rootpath,'../tango-matlab/highlevel-tango-matlab'),...  % expects to find tango matlab in the parent directory
12 13
        fullfile(rootpath),... % USE THIS FOLDER for matlab code, not /operation/machine/matlab
        fullfile(rootpath,'../at/atmat'),...
14
        fullfile(rootpath,'../EbsSimuMatlab'),...
15 16
        fullfile(rootpath,'../at/atintegrators'),...
        fullfile(rootpath,'../at/machine_data'));
17 18
end

19 20
% remove from path
rmpath(genpath( fullfile(rootpath,'optics')) );
21
rmpath(genpath( fullfile(rootpath,'../at/atmat/pubtools/LatticeTuningFunctions')) );
22 23
% remove .git folders
rmpath(genpath( fullfile(rootpath,'.git')) );
24 25
%rmpath(genpath( fullfile(rootpath,'../tango-matlab/.git')) );
%rmpath(genpath( fullfile(rootpath,'../at/.git')) );
26
rmpath(genpath( fullfile(rootpath,'../EbsSimuMatlab/.git')) );
27

beamdyn's avatar
beamdyn committed
28
%rmpath(genpath( fullfile(rootpath,'fun_tom')) );
29

30 31 32 33
set(0,'DefaultFigurePaperType','A4',...
    'DefaultFigurePaperUnit','centimeters',...
    'DefaultFigurePaperPosition',[2.5 9 16 12]);

34
% current folder is APPHOME.
35
setenv('APPHOME',rootpath);
36

37
APPHOME=getenv('APPHOME'); % to overwrite existing APPHOME (ESRF->EBS test))
38
MACHFS = '/machfs';% [APPHOME '/..']; % for test ESRF->EBS
39 40
if isempty(APPHOME), APPHOME=getenv('APPHOME'); end

41 42 43 44
disp(['APPHOME is: ' APPHOME]);
disp(['MACHFS is: ' MACHFS]);
disp(['TANGO_HOST is: ' getenv('TANGO_HOST')]);

45 46
function optpath(varargin)
for i=nargin:-1:1
47
    if (exist(varargin{i},'dir') == 7), addpath(genpath(varargin{i})); end
48
end