Customizing variables and scopes in simulink code generation

조회 수: 1 (최근 30일)
Jacob Thomas
Jacob Thomas 2023년 11월 22일
댓글: Fangjun Jiang 2023년 11월 22일
Hi Community,
I would like to know what does have more impact while code is generated inside Simulink. Is it the signals or the blocks? Also the variables assigned in workspace have any influence in code generation.
I want to achive a certain rules for the functions and defined variables in the generated code, eg:- in workspace I define the variable as uint8(PidKpVal) and when code is generated that needs to be in the format ---> UNSIGNED8 u8PidKpVal and same for the function ---> UNSIGNED16 pid_ctrl_u16PlantPosition_mm.
where can i define and is there any possibility of customize as that of the sl_customization.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2023년 11월 22일
To control how parameters and signals are created in the generated code, you need to use Simulink.Parameter and Simulink.Signal objects.
Search "Simulink.Parameter" and "Simulink.Signal" in the document for examples and tutorials.
  댓글 수: 2
Jacob Thomas
Jacob Thomas 2023년 11월 22일
That's nice. thanks for the reply. Is there any way that we could prevent the code to be geneated unless the model advisor checks has been done?

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

추가 답변 (0개)

카테고리

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