function simulinkrc
% Master startup MATLAB function for Simulink
%
% Automatically executed by the dispatcher when libmwsimulink.dll is
% loaded into memory.  Checks some aspects of the installation, loads
% user preferences, and runs customizations.
%
% Also executes any function called "startupsl" that is found on
% the MATLAB path.

%   Copyright 1984-2022 The MathWorks, Inc.
    
performance.productStats.logEventTime('SLStartup','simulinkrcBegin');

h = DAServiceManager.OnDemandService;
h.Start('SimulinkrcBegin');
runPostStartup = onCleanup(@()h.Start('SimulinkrcEnd'));

% Warn if the OS does not have the libraries required to use Simulink
if strcmp(computer('arch'), 'glnxa64')
    missingLibraries = matlab.internal.webwindow.findMissingLibraries();
    if ~isempty(missingLibraries)
        warning(message('Simulink:utility:SimulinkMissingLibraries', sprintf('\t%s\n', missingLibraries)));
    end
end

% Load Simulink Preferences 
try %#ok<TRYNC>
    slinstallprefs;
end

% Execute startupsl MATLAB script for Simulink, if it exists.
startup_exists = exist('startupsl','file');
if startup_exists == 2 || startup_exists == 6
  evalin('base','startupsl')
end

% Customization manager
performance.productStats.logEventTime('SLStartup','slCustomizerBegin');
slCustomizer.staticRefresh();
performance.productStats.logEventTime('SLStartup','slCustomizerEnd');
performance.productStats.logEventTime('SLStartup','simulinkrcEnd');

% Trigger MLInitialize_sl_block_graphics(g2337699)
DVG.Registry.isIconRegistered("icon");

end
