startmachine.m 1.61 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',...
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')) );
beamdyn's avatar
beamdyn committed
21
%rmpath(genpath( fullfile(rootpath,'fun_tom')) );
22

23 24 25 26
set(0,'DefaultFigurePaperType','A4',...
    'DefaultFigurePaperUnit','centimeters',...
    'DefaultFigurePaperPosition',[2.5 9 16 12]);

27
% current folder is APPHOME.
28
setenv('APPHOME',rootpath);
29

30
APPHOME=getenv('APPHOME'); % to overwrite existing APPHOME (ESRF->EBS test))
31
MACHFS = '/machfs';% [APPHOME '/..']; % for test ESRF->EBS
32 33
if isempty(APPHOME), APPHOME=getenv('APPHOME'); end

34 35 36 37
disp(['APPHOME is: ' APPHOME]);
disp(['MACHFS is: ' MACHFS]);
disp(['TANGO_HOST is: ' getenv('TANGO_HOST')]);

38 39
function optpath(varargin)
for i=nargin:-1:1
40
    if (exist(varargin{i},'dir') == 7), addpath(genpath(varargin{i})); end
41
end