O'Reilly logo

Getting Started with Simulink by Luca Zamboni

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Summary

In this chapter we've learned what S-functions are and how they can be used to build custom blocks to extend the basic Simulink functionality.

We have learned which required callbacks and optional ones need to be implemented if the S-function will use work vectors to store internal states and allocate system resources.

We developed and built two simple Level 2 MATLAB S-function blocks and used them to interface the cruise controller model with an external application. Then we implemented the same block functionality in the C language, learning how to develop and build C MEX S-functions with the mex tool.

These S-functions can be used as a good starting point to develop other interfaces to communicate with virtually any application or physical ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required