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

조회 수: 4 (최근 30일)
Vighnesh
Vighnesh 2022년 8월 19일
답변: Aniket 2024년 10월 11일
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