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

4 次查看(过去 30 天)
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
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!

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by