- Add an S-Function Builder block to your Simulink model (found under User-Defined Functions in the Simulink Library Browser).
- Double-click the block to open the configuration editor:
- Under the "Inputs" tab, no input is needed since your function has no arguments.
- Under the "Outputs" tab, define one output port, e.g., y, with:
- Go to the "Data Properties" tab and add the line mentioned below to the "Include" section:
- Under the "Outputs" section, add the function call:
- Click "Build" to generate the S-function.
- Use the generated block in your model—this will now call your external C function during simulation.
