Associates result details with a check object
setResultDetails(ElementResults)
In the check callback function, use
setResultDetails(
to associate
ElementResults
)ElementResults
with the check (CheckObj
).
ElementResults
is a collection of instances of the
ModelAdvisor.ResultDetail
class.
ElementResults | Collection of |
This example shows the result details that correspond to the execution of check
Check whether block names appear below blocks in the
AdvisorCustomizationExample
model. At the end of the code,
CheckObj.setResultDetails(ElementResults);
associates the results
with the check object. For more information, see Create and Deploy a Model Advisor Custom Configuration.
% ----------------------------- % This callback function uses the DetailStyle CallbackStyle type. % ----------------------------- function DetailStyleCallback(system, CheckObj) mdladvObj = Simulink.ModelAdvisor.getModelAdvisor(system); % get object % Find all blocks whose name does not appear below blocks violationBlks = find_system(system, 'Type','block',... 'NamePlacement','alternate',... 'ShowName', 'on'); if isempty(violationBlks) ElementResults = ModelAdvisor.ResultDetail; ElementResults.IsInformer = true; ElementResults.Description = 'Identify blocks where the name is not displayed below the block.'; ElementResults.Status = 'All blocks have names displayed below the block.'; mdladvObj.setCheckResultStatus(true); else ElementResults(1,numel(violationBlks))=ModelAdvisor.ResultDetail; for i=1:numel(ElementResults) ElementResults(i).setData(violationBlks{i}); ElementResults(i).Description = 'Identify blocks where the name is not displayed below the block.'; ElementResults(i).Status = 'The following blocks have names that do not display below the blocks:'; ElementResults(i).RecAction = 'Change the location such that the block name is below the block.'; end mdladvObj.setCheckResultStatus(false); mdladvObj.setActionEnable(true); end CheckObj.setResultDetails(ElementResults); end