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

4 visualizzazioni (ultimi 30 giorni)
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.

Risposte (1)

Aniket
Aniket il 11 Ott 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!

Categorie

Scopri di più su Simulink Coder in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by