주요 콘텐츠

이 페이지는 기계 번역을 사용하여 번역되었습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.

setResultDetails

결과 세부정보를 검사 개체와 연결합니다.

구문

setResultDetails(ElementResults)

설명

검사 콜백 함수에서 setResultDetails(ElementResults)을 사용하여 ElementResults을 검사(CheckObj)와 연결합니다.

ElementResultsModelAdvisor.ResultDetail 클래스의 인스턴스 모음입니다.

입력 인수

ElementResults

ResultDetailObjs 개체 컬렉션

예제

이 예에서는 AdvisorCustomizationExample 모델에서 블록 이름이 블록 아래에 표시되는지 검사 확인 실행에 해당하는 결과 세부 정보를 보여줍니다. 코드 끝에서 CheckObj.setResultDetails(ElementResults);는 결과를 검사 개체와 연결합니다. 자세한 내용은 Create and Deploy Model Advisor Custom Configuration을 참조하세요.

% -----------------------------
% 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

버전 내역

R2018b에 개발됨