Generating a DLL shared library from a Simulink model with an S-function

I'm trying to generate a DLL from a Simulink fixed wing autopilot model which contains an S function written in Matlab. I follow the standard procedure using Embedded Coder but I end up with the following error:
For code generation, S-function parameters must be one or two dimensional nonsparse numeric or character arrays unless the S-function uses a TLC file and has an mdlRTW function.
Any leads to fix this issue would be great.
Thanks in advance.

回答 (1 件)

Aniket
Aniket 2024 年 10 月 11 日

0 投票

When generating code for a Simulink model that includes an S-function, you may encounter the error indicating that the S-function parameters must be one or two-dimensional nonsparse numeric or character arrays.
This might happen because of these possible scenarios:
1. Passing a 3D or higher dimensional array: 3D inputs are supported for the S-function but not natively supported for code generation. A TLC file is needed to handle complex data types.
2. S-functions that call into MATLAB are not supported for code generation.
Refer to this link to know more about S-function Code Generation capabilities:
Please follow these possible workarounds to resolve the issue:
1. Define your own code generation using the C function/Target Language Compiler (TLC) file & mdlRTW function.
Please find its documentation in the link below:
2. If the purpose of using S-function is to protect your intellectual property, instead of generating an S-Function you can try creating a protected model.
I hope this helps resolve the issue!

カテゴリ

ヘルプ センター および File ExchangeSimulink Coder についてさらに検索

質問済み:

2022 年 8 月 19 日

回答済み:

2024 年 10 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by