Undefined identifier when using LibMdlStartCustomCode

조회 수: 10 (최근 30일)
Stéphane
Stéphane 2022년 8월 31일
답변: Kausthub 2023년 10월 6일
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 ?

답변 (1개)

Kausthub
Kausthub 2023년 10월 6일
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!

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by