Codegen for M-S-Function
2 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have a very complex M-S-Function block that uses classes and I would like to use it for codegen of a simulink model.
It will not be possible to write a reimplementation of the code as a tlc file without significant effort and loss of functionality.
Is it possible to do this?
Thank You
0 件のコメント
回答 (1 件)
Anshuman
2023 年 5 月 15 日
Hi Nima,
It may be possible to generate C code from your Simulink model that includes your M-S-Function block using the Simulink Coder's code generation technology. However, there are several requirements that your M-S-Function block and associated classes must meet in order for this to work.
Firstly, the classes used in your M-S-Function block must be defined using MATLAB classes that are supported by Simulink Coder's code generation. Specifically, only a subset of MATLAB classes is supported, and not all classes can be used in code generation.
Secondly, any MATLAB code that is used in your M-S-Function block must be compatible with code generation. In practical terms, this means that the MATLAB code used in your M-S-Function block should not include any constructs or functions that are not compatible with code generation, such as certain built-in functions, unsupported toolboxes, or MEX files.
Finally, your M-S-Function block and associated classes should adhere to certain design guidelines for code generation. For example, you should avoid using dynamic memory allocation, avoid using global variables, and avoid using recursive function calls.
If you are able to meet these requirements, you can generate C code from your Simulink model using the Simulink Coder. You can go through the documentation if you need any help in generating C code from a simulink model.
Hope it helps!
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!