| Simulink® Verification and Validation™ | ![]() |
| On this page… |
|---|
About Process Callback Functions |
The process callback function is an optional function that lets you modify the appearance of checks and tasks in the Model Advisor, and process check results at run time. The process callback function specifies actions to be performed at different stages of Model Advisor execution:
configure stage: The Model Advisor executes configure actions at startup, after all checks and tasks have been initialized. At this stage, you can specify actions to customize how the Model Advisor constructs lists of checks and tasks by modifying Visible, Enable, and Value properties. For example, you can remove, rename, and selectively display checks and tasks.
process_results stage: The Model Advisor executes process_results actions after checks complete execution. You can specify actions to examine and report on the results returned by check callback functions.
If you create a process callback function, you must register it as described in Registering Custom Checks, Tasks, and Groups. The sections that follow provide mode information about defining your own process callback functions.
The process callback function takes the following arguments:
| Argument | I/O Type | Data Type | Description |
|---|---|---|---|
| stage | Input | Enumeration | Specifies the stages at which process callback actions are executed. Use this argument in a switch statement to specify actions for the stages configure and process_results. |
| system | Input | Path | Model or subsystem to be analyzed by Model Advisor. |
| checkCellArray | Input/Output | Cell array | As input, the array of checks constructed in the check definition function. As output, the array of checks modified by actions in the configure stage. |
| taskCellArray | Input/Output | Cell array | As input, the array of tasks constructed in the task definition function. As output, the array of tasks modified by actions in the configure stage. |
Here is an example of a process callback function that specifies actions in the configure stage to enable only the custom checks assigned to the Demo group in Code Example: Check Definition Function. In the process_results stage, this function displays an informative dialog box for checks that do not pass.
function [checkCellArray taskCellArray] = ...
ModelAdvisorProcessFunction(stage, system, checkCellArray, taskCellArray)
switch stage
case 'configure'
for i=1:length(checkCellArray)
% hidden all checks that do not belong to Demo group
if ~(strcmp(checkCellArray{i}.Group, 'Demo'))
checkCellArray{i}.Visible = false;
checkCellArray{i}.Value = false;
end
end
case 'process_results'
for i=1:length(checkCellArray)
% print message if check does not pass
if checkCellArray{i}.Selected && ...
(strcmp(checkCellArray{i}.Title, ...
'Check Simulink window screen color'))
if isempty(strfind(checkCellArray{i}.Result, 'Passed'))
disp('Example message from Model Advisor Process callback.');
end
end
end
end
![]() | Defining Custom Groups | Formatting Model Advisor Outputs | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |