Using Simulink Coder, how do I make sure that workspace parameters (variable references) in Simulink Blocks are recognized as such when generating code for S-function targets?

3 visualizaciones (últimos 30 días)
I am trying to convert a model to S-function executable, but discovered that while the generated code honors some instances of the parameters (via mxGetData() calls), in other calculations the values of the default, dummy, model workspace variables (required to define ref model arguments) are hard-wired.
How can I get the autocoded code to honor the run-time parameter values exclusively?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 18 de Jun. de 2019
Sometimes, the S-function can be created with code generation options that prevent it from initializing all the parameters at run-time like you want.
Please generate the S-Function again with the following options:
- Keep the tlc selection you have previously rwtsfun.tlc
- In the Code Generation -> Optimization tab, Select Default parameter behavior: Tunable.
- In the Diagnostics -> Compatibility tab, Select S-function upgrades needed: none
- Then generate code
The resulting S-Function Block should open after code generation. If you double click on it, you will see that the Block's mask prompts you for all the input parameters in separate boxes. This means the generated code detected these parameters as needing user initialization, which you can provide by typing the name of the corresponding struct variables in each box.

Más respuestas (0)

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by