How to use inlining for S-Function in Simulink with PLC Coder? Or, how to convert C++ code to other languages with PLC Coder?

6 ビュー (過去 30 日間)
min
min 2025 年 4 月 10 日
回答済み: Aabha 2025 年 4 月 24 日
When I compile my C++code into ST language using the S-Function in Simulink with the PLC Coder compiler,it shows that the PLC Coder supports inlined S-Functions but does not support non-inlined ones.How can I use inlining?Alternatively,how can I convert C++to another language through the PLC Coder compiler in Simulink?

回答 (1 件)

Aabha
Aabha 2025 年 4 月 24 日
Hi @min,
I faced a similar issue while generating code from an ‘s-function block using PLC Coder. I came across a previous MATLAB Answers post, where it was mentioned that PLC Coder does not support generating code from s-function blocks, and that the error message might be misleading: https://www.mathworks.com/matlabcentral/answers/725-can-i-generate-plc-code-from-an-s-function-using-plc-coder.
As a workaround, you can try using the ‘MATLAB function block to implement the s-function block functionality, since PLC Coder supports code generation from the ‘MATLAB function’ block.
Additionally, if you wish to know more about how ‘s-functions’ can be inlined, please refer to the following documentation link:
I hope this helps.

カテゴリ

Help Center および File ExchangeSimulink PLC Coder についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by