선택한 모델 어드바이저의 검사를 실행하고 리포트 생성하기
이 예제에서는 Simulink 모델에서 선택한 모델 어드바이저 검사를 프로그래밍 방식으로 실행하고 개별 검사 결과를 검색하며 결과를 요약한 HTML 리포트를 생성하는 방법을 보여줍니다. 이 워크플로에서는 예제가 모델 내 연결되지 않은 선과 단위 불일치를 검사하여 잠재적인 모델링 문제와 복잡도를 식별하는 데 도움을 줍니다.
예제 모델을 엽니다.
model = "sldemo_mdladv";
open_system(model);Create a Model Advisor object for the system:
ma = Simulink.ModelAdvisor.getModelAdvisor(model);
Updating Model Advisor cache... Model Advisor cache updated. For new customizations, to update the cache, use the Advisor.Manager.refresh_customizations method.
Specify the Model Advisor checks to run by their IDs.
selectedCheck = {'mathworks.design.UnitMismatches','mathworks.design.UnconnectedLinesPorts'};Run the Model Advisor checks.
a = runCheck(ma,selectedCheck);
Set the destination file for the report.
destination = fullfile(pwd,"AdvisorExport.html");리포트를 내보내고 출력과 메시지를 캡처합니다.
[output,message] = exportReport(ma,destination);
결과를 표시합니다.
if output fprintf("Report exported successfully: %s\n",message); else fprintf("Report export failed: %s\n",message); end
Report exported successfully:
참고 항목
modeladvisor | Simulink.ModelAdvisor