Why is my custom System object not compatible with code generation?
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 2 Fév 2023
Réponse apportée : MathWorks Support Team
le 7 Fév 2023
I have a Simulink model that I created in R2022a and that contains a MATLAB System block that uses a custom System object. My System object has relatively simple methods and only a few properties (a public, tunable property, a public, variable-size, discrete state property, and a few other private properties).
When I run my model in "Interpreted execution" mode, my model simulates as expected. However, when I run my model in "Code generation" mode, I run into the following error stating that my System object is using code that does not support code generation.
The error occurred for MATLAB System block 'MATLABSysObjCodeGenTest/MATLAB System'.
To prevent this error, use one of the following:
* Modify the System object to avoid code that does not support code generation.
* Change 'Simulate using' parameter to 'Interpreted Execution'.
How can I make my System object code generation compatible?
Réponse acceptée
MathWorks Support Team
le 2 Fév 2023
In order for MATLAB System blocks to be code generation compatible, you cannot use variable-size for discrete state properties of System objects; however, private properties can be variable-size. The following link outlines this requirement along with others for specifically making System objects compatible with code generation:
Changing the public, variable-size, discrete state property to a private property instead should allow for the model to be code generation compatible.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Simulink Coder dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!