%MATLABRC Master startup M-file.
%   MATLABRC is automatically executed by MATLAB during startup.
%   It establishes the MATLAB path, sets the default figure size,
%   and sets a few uicontrol defaults.
%
%	On multi-user or networked systems, the system manager can put
%	any messages, definitions, etc. that apply to all users here.
%
%   MATLABRC also invokes a STARTUP command if the file 'startup.m'
%   exists on the MATLAB path.

% For VMS, set up the MATLAB search path.
cname = computer;
if (length (cname) >= 7)
   % Note: the strcmp function isn't in the path yet so it can't be used here
   if (cname(1) == 'V')
      eval('pathdef');
   end
end

% Set the default figure position, in pixels.
% On small screens, make figure smaller, with same aspect ratio.
screen = get(0, 'ScreenSize');
width = screen(3);
height = screen(4);
if all(cname(1:2) == 'PC')
   if height >= 500
      mwwidth = 560; mwheight = 420;
   else
      mwwidth = 560; mwheight = 375;
   end
   left = (width - mwwidth)/2;
   bottom = height - mwweight -60;
else
   if height > 768
      mwwidth = 560; mwheight = 420;
      left = (width-mwwidth)/2;
      bottom = height-mwheight-60;
   else  % for screens that aren't so high
      mwwidth = 512; mwheight = 384;
      left = (width-mwwidth);
      bottom = height-mwheight-50;
   end
end
rect = [ left bottom mwwidth mwheight ];
set(0, 'defaultfigureposition',rect);

% Make uicontrols, uimenus and lines look better on monochrome displays.
if get(0,'ScreenDepth')==1,
   set(0,'DefaultUIControlBackgroundColor','white');
   set(0,'DefaultUIMenuBackgroundColor','white');
   set(0,'DefaultAxesLineStyleOrder','-|--|:|-.')
   set(0,'DefaultAxesColorOrder',[1 1 1]);
end

% Better default uicontrol colors for Windows
if all(cname(1:2)=='PC')
   set(0,'DefaultUIControlBackgroundColor',[128/255 128/255 128/255])
end

% Display helpful hints.
disp('Commands to get started: intro, demo, help help')
disp('Commands for more information: help, whatsnew, info, subscribe')
disp(' ')

% Clean up work space.
%clear screen width height mwwidth mwheight left bottom rect
clear
flops(0);

% Execute startup M-file, if it exists.
if exist('startup.m')
    startup
end

% Load ACSL exchange file, if it exists.
if isunix | isvms
   if exist('acsl_matlab.tmp')
        load acsl_matlab.tmp -mat
        delete acsl_matlab.tmp
   end
end
