Terminate Code Generation Process

10 次查看(过去 30 天)
David Friesen
David Friesen 2021-4-7
回答: Akshat Dalal 2024-8-21,4:45
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,4:45
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