How can I tell Simulink Embedded Coder to get its variable names from my signal names, not the source block names?
1 次查看(过去 30 天)
显示 更早的评论
I am generating C code from a Simulink model using Simulink Embedded Coder with the ERT target. I can see that the variable names generated in the code are formatted according to the Configuration Parameters under the Code Generation/Symbols pane. For example, I am using $N$M for my local temporary variables. In the simplified cases, the mangle is unnecessary and the variable name is just the value of $N, "Name of object being identified."
If I have two signals, a and b entering a Sum block and producing a signal named c, the signal emerging from the Sum block corresponds to a generated variable named Sum. But in my mental model, signals are the variables and blocks are the functions/operations. So I would like the variable to be named c, not Sum.
How can I tell Simulink to inherit its variable names from the signal names, not the block names?
I am using MATLAB R2015a (64-bit) and Windows 7. I set up mex to use the Microsoft Visual C++ 2010 (C) compiler.
1 个评论
Xiaojie Qiu
2019-1-14
Hi Robert! Could you please tell me whether you got a solution to this problem? Thank you!
回答(1 个)
Fangjun Jiang
2019-1-14
Select the signal line, right click, select "Properties"
Provide the signal name (e.g. "c" ), check "Signal name must resolve to Simulink signal object"
Create the Simulink signal object in workspace or SLDD
c=Simulink.Signal or c=mpt.Signal
open c
Provide necessary parameters or just take the default value
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!