How to make non inlined s-functions inlined for code generation

7 views (last 30 days)
I'm in simulink with a subsystem, I right click, c c++ code gen, create s-function. When I control b to build code, I get an error about non-inlined sfunction. I see I need the sfunction.tlc header file to create an inlined sfunction. How do I create this for each s-function I need to build for?
sfcn' is a non-inlined S-function, which is not supported with the current configuration. Consider selecting Support non-inlined S-functions.

Answers (1)

Raghava S N
Raghava S N on 7 Aug 2024
Hi Aubrey,
Writing S-functions to be included in generated code involves requirements that go beyond writing S-functions used only for simulation. Before proceeding to inline an S-function, make sure that it meets the requirements for code generation and functions as expected. For more information, refer to the documentation of “S-Functions and Code Generation” by using the “web” command in the MATLAB command window -
web(fullfile(docroot, '/rtw/ug/s-functions-and-code-generation.html'))
Once the requirements are met, you can inline the functionality of MATLAB file S-functions in the generated code. For the step-by-step guide on how to inline MATLAB File S-Functions in Simulink, refer to the documentation of “Inline S-Functions” by using the “web” command in the MATLAB command window -
web(fullfile(docroot, '/rtw/tlc/introduction-inline-s-functions.html'))
Hope this helps!
Raghava

Categories

Find more on Function Creation in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!