Parameters are not referenced by pointers since MATLAB R2019a. How do I generate compatible code?

4 visualizzazioni (ultimi 30 giorni)
In MATLAB R2018b and prior versions, the real-time model accessed the parameter data in the top model through a pointer (foo->bar). Since MATLAB R2019a, it is accessed as a standalone global variable in C (bar), or as a static member of the model class (foo.bar).
I want to integrate code generated from a more recent release with older generated code.

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 29 Lug 2024
Modificato: MathWorks Support Team il 29 Ago 2024
In R2018b and prior releases, in the code with "Reusable function" packaging, parameter data in the top model was accessed through a pointer in the real-time model. You could define different parameter values for each instance of a top model. Such parameters are referred to as "multi-instance". In R2019a and post releases, the parameters that are required to be multi-instance need to be stored in the model workspace, their storage class be set to ModelDefault, and Argument check box selected for them:
  1. In Configuration Parameters, navigate to the Code Generation > Interface tab. In the "Code Interface" setting, ensure that "Code interface packaging" is set to "Reusable function".
  2. In Model Explorer, navigate to your model workspace, select your parameter the you want to be multi-instance, and enable the checkbox titled "Argument" on the right.
  3. In the Code Mappings editor, go to the Parameters tab, and change your parameter's Storage Class to "Model default".
You can find this change in the MATLAB R2019a release notes by running the below command in the command window of installed MATLAB R2019a version to get release specific documentation
>> web(fullfile(docroot, 'ecoder/release-notes.html'))
Please follow the below link to search for the required information regarding the current release:

Più risposte (0)

Categorie

Scopri di più su Simulink Coder in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by