Why is my custom System object not compatible with code generation?
11 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2023 年 2 月 2 日
回答済み: MathWorks Support Team
2023 年 2 月 7 日
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?
採用された回答
MathWorks Support Team
2023 年 2 月 2 日
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 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!