Main Content

ModelAdvisor.Check.setResultDetails

R2026b

Associates result details with a check object

Description

setResultDetails(ElementResults) assigns the specified ElementResults objects as result details for the check object in the check callback function.

Examples

collapse all

This example shows how to associate detailed result information with a custom Model Advisor check object.

Create a Model Advisor check object and assign a DetailStyle callback function.

CheckObj = ModelAdvisor.Check('com.mathworks.mySampleCheck');
CheckObj.Title = 'Sample check with result details';
CheckObj.setCallbackFcn(@DetailStyleCallback, 'None', 'DetailStyle');

Define the callback function. Inside the callback, create a result detail object and associate it with the check using setResultDetails.

function DetailStyleCallback(system, CheckObj)
    resultDetail = ModelAdvisor.ResultDetail;
    resultDetail.Description = 'Block name does not appear below the block.';
    resultDetail.Status = 'Violation found.';
    resultDetail.ViolationType = 'warn';
    CheckObj.setResultDetails(resultDetail);
end

Register the check with the Model Advisor root and run it.

mdladvRoot = ModelAdvisor.Root;
mdladvRoot.publish(CheckObj, 'Demo');
Advisor.Manager.refresh_customizations;

Input Arguments

collapse all

Represents a collection of instances of the ModelAdvisor.ResultDetail class.

Version History

Introduced in R2018b