Terminate Code Generation Process

3 visualizaciones (últimos 30 días)
David Friesen
David Friesen el 7 de Abr. de 2021
Respondida: Akshat Dalal el 21 de Ag. de 2024
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 comentario
Fangjun Jiang
Fangjun Jiang el 7 de Abr. de 2021
Editada: Fangjun Jiang el 7 de Abr. de 2021
You could just error() in the hook .m file. That would stop the process. Not most graceful but no harm done.

Iniciar sesión para comentar.

Respuestas (1)

Akshat Dalal
Akshat Dalal el 21 de Ag. de 2024
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

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by