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

5 Ansichten (letzte 30 Tage)
Vighnesh
Vighnesh am 19 Aug. 2022
Beantwortet: Aniket am 11 Okt. 2024
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.

Antworten (1)

Aniket
Aniket am 11 Okt. 2024
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!

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by