CallbackStyle property

Callback function type

Values

'StyleOne' (default)
'StyleTwo'
'StyleThree'
'DetailStyle'

Description

The CallbackStyle property specifies the type of the callback function.

'DetailStyle'

Check callback function for detailed result collections. (Recommended).

'StyleOne'

Simple check callback function.

'StyleTwo'

Detailed check callback function

'StyleThree'

Check callback function with hyperlinked results

Detailed Results Collection Callback Function

To use the default format of the Model Advisor report, use DetailStyle. With the default format, you do not have to use the ModelAdvisor.FormatTemplate class or the other Model Advisor Formatting APIs to format the results that appear in the Model Advisor. This style also allows you to view results by block, subsystem, or recommended action. For examples, see Fix a Model to Comply with Conditions that You Specify With the Model Advisor and Create the Check Definition Function for a Pass/Fail Check with No Fix Action.

If the default formatting does not meet your needs, use one of the other callback function styles and use the ModelAdvisor.FormatTemplate API or the other formatting APIs.

Simple Callback Function

Use a simple check callback function with results formatted using the Result Template API to indicate whether the model passed or failed the check, or to recommend fixing an issue. The keyword for this callback function is StyleOne. The check definition requires this keyword.

The check callback function takes the following arguments.

ArgumentI/O TypeDescription
systemInputPath to the model or subsystem analyzed by the Model Advisor.
resultOutputMATLAB® character vector that supports Model Advisor Formatting API calls or embedded HTML tags for text formatting.

Detailed Check Callback Function

This example shows how to create a detailed check callback function. Use the detailed check callback function to return and organize results as strings in a layered, hierarchical fashion. The function provides two output arguments so you can associate text descriptions with one or more paragraphs of detailed information. The keyword for the detailed callback function is StyleTwo. The check definition requires this keyword.

The detailed callback function takes the following arguments.

ArgumentI/O TypeDescription
systemInputPath to the model or system analyzed by the Model Advisor.
ResultDescriptionOutputCell array of MATLAB character vectors that supports Model Advisor Formatting API calls or embedded HTML tags for text formatting. The Model Advisor concatenates the ResultDescription character vector with the corresponding array of ResultDetails character vectors.
ResultDetailsOutputCell array of cell arrays, each of which contains one or more character vectors.

Note

The ResultDetails cell array must be the same length as the ResultDescription cell array.

This example shows a detailed check callback function that checks optimization settings for simulation and code generation.

Check Callback Function with Hyperlinked Results

This example shows how to create a callback function with hyperlinked results. This callback function automatically displays hyperlinks for every object returned by the check so that you can easily locate problem areas in your model or subsystem. The keyword for this type of callback function is StyleThree. The check definition requires this keyword.

This callback function takes the following arguments.

ArgumentI/O TypeDescription
systemInputPath to the model or system analyzed by the Model Advisor.
ResultDescriptionOutputCell array of MATLAB character vectors that supports the Model Advisor Formatting API calls or embedded HTML tags for text formatting.
ResultDetailsOutputCell 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 character vector 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.

This example shows 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.