User`s guide

Create a Procedural-Based Configuration
27-5
Create a Procedural-Based Configuration
In this example, you examine a procedural-based configuration.
1
At the MATLAB command line, type slvnvdemo_mdladv.
2
In the model window, select View demo sl_customization.m. The
sl_customization.m file opens in the MATLAB Editor window.
The file contains three checks created in the function
defineModelAdvisorChecks:
ModelAdvisor.Check('com.mathworks.sample.Check1') - Checks
Simulink block fonts.
ModelAdvisor.Check('com.mathworks.sample.Check2') - Checks
Simulink window screen color.
ModelAdvisor.Check('com.mathworks.sample.Check3') - Checks model
optimization settings.
Each check has a set of fix actions.
3
In the sl_customization.m file, examine the function defineTaskAdvisor.
The ModelAdvisor.Procedure class API creates procedures My Procedure
and My sub_Procedure:
% Define procedures
MAP = ModelAdvisor.Procedure('com.mathworks.sample.ProcedureSample');
MAP.DisplayName='My Procedure';
MAP_sub = ModelAdvisor.Procedure('com.mathworks.sample.sub_ProcedureSample');
MAP_sub.DisplayName='My sub_Procedure';
The ModelAdvisor.Task class API creates tasks MAT4, MAT5, and MAT6. The
ModelAdvisor.Task.setCheck method adds the checks to the tasks:
% Define tasks
MAT4 = ModelAdvisor.Task('com.mathworks.sample.TaskSample4');
MAT4.DisplayName='Check Simulink block font';
MAT4.setCheck('com.mathworks.sample.Check1');
mdladvRoot.register(MAT4);
MAT5 = ModelAdvisor.Task('com.mathworks.sample.TaskSample5');
MAT5.DisplayName='Check Simulink window screen color';
MAT5.setCheck('com.mathworks.sample.Check2');
mdladvRoot.register(MAT5);