Registering Custom Checks, Tasks, and Groups

About Registering Custom Checks, Tasks, and Groups

To register checks, tasks, and groups in the Model Advisor, you must create the function sl_customization() in the sl_customization.m file on your MATLAB® path. This function accepts one argument, a handle to an object called Simulink.CustomizationManager, as in this example:

function sl_customization(cm)

The customization manager object includes methods for registering custom checks and tasks. You should use these methods to register customizations specific to your application, as described and demonstrated in the sections that follow.

Simulink® reads sl_customization.m files when it starts. If you subsequently change the contents of your customization file, update your environment by performing these tasks:

  1. Close the Model Advisor if it is open.

  2. If you previously opened the Model Advisor, reinitialize it either by removing the slprj folder from your working directory or by closing your model.

  3. Enter the following command at the MATLAB command line:

    sl_refresh_customizations
  4. Open your model.

  5. Start the Model Advisor.

Methods for Registering Custom Checks and Groups

The Simulink.CustomizationManager class includes the following methods for registering custom checks and tasks:

Code Example: Methods for Registering Custom Checks and Tasks

The following code example registers custom checks, custom tasks, and a process callback function:

function sl_customization(cm)

% register custom checks
cm.addModelAdvisorCheckFcn(@defineModelAdvisorChecks);

% register custom factory group
cm.addModelAdvisorTaskFcn(@defineModelAdvisorTasks);

% register custom tasks.
cm.addModelAdvisorTaskAdvisorFcn(@defineTaskAdvisor);

% register custom process callback
cm.addModelAdvisorProcessFcn(@ModelAdvisorProcessFunction);
  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS