Undefined identifier when using LibMdlStartCustomCode

6 visualizaciones (últimos 30 días)
Stéphane
Stéphane el 31 de Ag. de 2022
Respondida: Kausthub el 6 de Oct. de 2023
Hi,
I'm using the function LibMdlStartCustomCode in a tlc file:
%<LibMdlStartCustomCode("aaa","trailer")>
However, I obtain the following error message at code generation:
Error: File: C:\Program Files\MATLAB\R2021b\rtw\c\tlc\mw\hookslib.tlc Line: 320 Column: 22
Undefined identifier System
Main program:
==> [00] C:\Program Files\MATLAB\R2021b\rtw\c\tlc\mw\hookslib.tlc:LibMdlStartCustomCode(320)
do anyone have an idea what is going on ?

Respuestas (1)

Kausthub
Kausthub el 6 de Oct. de 2023
Hi Stéphane,
I understand that you are facing an error while generating code using a custom TLC file which contains the LibMdlStartCustomCodefunction.
The provided error message tells us that the identifier “System” is undefined (https://www.mathworks.com/help/rtw/tlc/tlc-error-messages.html). You get this error because System is not part of CompiledModel" which means that “System” is missing from your model.rtw file.
Some points to be noted:
  • “System” is defined in the “model.rtw file and does not require any additional assignment in the TLC file.
  • Please verify whether “System” is defined in the “model.rtw" file and check whether NumSystems” is greater than 0.
  • There is one “System” for each nonvirtual subsystem in your Simulink model. So, please ensure that your model contains at least one nonvirtual subsystem.
Here are few resources that might give a better understanding of the issue:
Hope this helps and solves your error!

Categorías

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

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by