User`s guide

Create Callback Functions and Results
25-41
Argument I/O Type Description
system Input Path to the model or system analyzed by
the Model Advisor.
ResultDescription Output Cell array of MATLAB strings that
supports the Model Advisor Formatting
API calls or embedded HTML tags for text
formatting.
ResultDetails Output Cell array of cell arrays, each of which
contains one or more Simulink objects
such as blocks, ports, lines, and Stateflow
charts. The objects must be in the form of a
handle or Simulink path.
Note: The ResultDetails cell array must be the same length as the
ResultDescription cell array.
The Model Advisor automatically concatenates each string from ResultDescription
with the corresponding array of objects from ResultDetails. The Model Advisor
displays the contents of ResultDetails as a set of hyperlinks, one for each object
returned in the cell arrays. When you click a hyperlink, the Model Advisor displays the
target object highlighted in your Simulink model.
The following is an example of a check callback function with hyperlinked results. This
example checks a model for consistent use of font type and font size in its blocks. It also
contains input parameters, actions, and a call to the Model Advisor Result Explorer,
which are described in later sections.
function [ResultDescription, ResultDetails] = SampleStyleThreeCallback(system)
ResultDescription ={};
ResultDetails ={};
mdladvObj = Simulink.ModelAdvisor.getModelAdvisor(system);
mdladvObj.setCheckResultStatus(true);
needEnableAction = false;
% get input parameters
inputParams = mdladvObj.getInputParameters;
skipFontCheck = inputParams{1}.Value;
regularFontSize = inputParams{2}.Value;
regularFontName = inputParams{3}.Value;
if skipFontCheck
ResultDescription{end+1} = ModelAdvisor.Paragraph('Skipped.');
ResultDetails{end+1} = {};