Simulink Code Generation Problem

4 次查看(过去 30 天)
Eray Dogan
Eray Dogan 2019-10-17
回答: Atharva 2023-8-10
Hi,
I am using a Matlab Function block in my simulink model. In that matlab function block i am using some local parameters without making extra definition for them.
When I generate a C code over my simulink model and check C code, I realize that matlab gives random different parameter names to those that I use in my matlab function locally.
Is there a reason for that?
How I can solve this problem?
Is there any setting in Configuration Parameter section to fix this?

回答(1 个)

Atharva
Atharva 2023-8-10
Hi Eray,
When generating C code from a Simulink model that includes a MATLAB Function block, the code generation process may rename local parameters used within the MATLAB Function block. This behavior is expected and is done to ensure the generated C code is valid and does not conflict with any existing variable names.
If you have any concerns about the renaming of parameters or if it is causing issues with your code, you can consider using input and output arguments for your MATLAB Function block instead of relying on local parameters. This will case the parameter names to be preserved in the generated code.

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

产品


版本

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by