Can the constant and gain block be saved as C code variables using the Simulink coder?

조회 수: 3 (최근 30일)
Hi all,
I am working to create a library by generating C code with Simulink coder.
When I checked the generated code, it was confirmed that the Contant and Gain blocks are directly used as numbers in C code.
I would like to have the Contant and Gain blocks as variable parameters.
Is this possible? I am wondering which option should be checked if possible.
Thanks.
  댓글 수: 1
Hyunjun Hyung
Hyunjun Hyung 2021년 3월 11일
I I got an answer from Technical Service.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
When you set Configuration Parameters > Optimization > Signals and Parameters > Default parameter behavior (see Default parameter behavior (Simulink)) to Tunable (the default when you use a GRT-based system target file such as grt.tlc), the generated code allocates memory to represent block parameters. Therefore, you can tune the block parameter values during code execution.

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

답변 (1개)

Vimal Rathod
Vimal Rathod 2021년 2월 23일
Hi,
You could always change your code after code generation using simulink coder. But if you want to save as variable in gain and constant block you could create a workspace variable and use that in those blocks.
Refer to the following link for more information on the workspace variables.

카테고리

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

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by