Terminate Code Generation Process

조회 수: 1 (최근 30일)
David Friesen
David Friesen 2021년 4월 7일
답변: Akshat Dalal 2024년 8월 21일
I am using the ert_make_rtw_hook.m (before tlc stage) file to run several scripts during the code generation process. These scripts are used to validate some custom (masked) blocks that I have created. I'm wondering if there is a way to terminate the build process if I detect an error with a setting in one of these custom blocks.
  댓글 수: 1
Fangjun Jiang
Fangjun Jiang 2021년 4월 7일
편집: Fangjun Jiang 2021년 4월 7일
You could just error() in the hook .m file. That would stop the process. Not most graceful but no harm done.

댓글을 달려면 로그인하십시오.

답변 (1개)

Akshat Dalal
Akshat Dalal 2024년 8월 21일
Hi David,
You could encapsulate your scripts in try-catch blocks. Threfore, if the script errors out, you can debug it easily by throwing a meaningful error. You could also use error() as suggessted by Fangjun.
Please refer the following documentation for more information on try-catch block: https://www.mathworks.com/help/matlab/ref/try.html

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by