Contenido principal

Esta página se ha traducido mediante traducción automática. Haga clic aquí para ver la última versión en inglés.

setResultDetails

Asociar detalles del resultado con un objeto de comprobación

Sintaxis

setResultDetails(ElementResults)

Descripción

En la función de callback de comprobación, utilice setResultDetails(ElementResults) para asociar ElementResults con la comprobación (CheckObj).

ElementResults es una colección de instancias de la clase ModelAdvisor.ResultDetail.

Argumentos de entrada

ElementResults

Colección de objetos ResultDetailObjs

Ejemplos

Este ejemplo muestra los detalles del resultado que corresponden a la ejecución de la comprobación Check whether block names appear below blocks en el modelo AdvisorCustomizationExample. Al final del código, CheckObj.setResultDetails(ElementResults); asocia los resultados con el objeto de comprobación. Para obtener más información, consulte Crear e implementar una configuración personalizada de Model Advisor.

% -----------------------------
% This callback function uses the DetailStyle CallbackStyle type. 
% -----------------------------
function DetailStyleCallback(system, CheckObj)
% Get the Model Advisor object.
mdladvObj = Simulink.ModelAdvisor.getModelAdvisor(system); 

% Find the blocks whose names do not appear below the block.
violationBlks = find_system(system, 'Type','block',...
    'NamePlacement','alternate',...
    'ShowName', 'on');
if isempty(violationBlks)
    ElementResults = ModelAdvisor.ResultDetail;
    ElementResults.ViolationType = 'info';
    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
    for i=1:numel(violationBlks)
	 ElementResults(1,i) = ModelAdvisor.ResultDetail;
    end
    for i=1:numel(ElementResults)
        ModelAdvisor.ResultDetail.setData(ElementResults(i), 'SID',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 block:';
        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

Historial de versiones

Introducido en R2018b