Skip to Main Content Skip to Search
Accelerating the pace of engineering and science

 

Training - Courses

SLEX: Integrating Code with Simulink

This one-day course presents multiple methods for integrating code into Simulink® models. The focus is on integrating C and MATLAB® code. Topics discussed include C MEX S-functions, Embedded MATLAB code, and the Legacy Code Tool for wrapping external C functions into Simulink. This course is intended for intermediate to advanced Simulink users.

VIEW SCHEDULE and Register SHARE with Manager/Colleague
 
 Detailed course outline
Day 1 of 1
Code Integration Methods

Objective: Become familiar with the various code integration methods and discuss how a Simulink model interacts with user-defined blocks.

  • Overview of all methods of code integration
  • Introduction to S-functions
Transitioning from MATLAB® to Simulink®

Objective: Integrate MATLAB code into Simulink models.

  • Writing an Embedded MATLAB function
  • Converting a MATLAB function to an Embedded MATLAB function
  • Embedded MATLAB coding rules
Calling External Routines

Objective: Integrate C code into a Simulink model using automated tools.

  • Calling an external C routine with the Legacy Code Tool
  • Calling an external C routine in an Embedded MATLAB Function
Writing Wrapper S-Functions

Objective: Integrate C code into a Simulink model by manually writing C MEX S-functions.

  • Writing a C MEX S-function
  • Calling external code from a C MEX S-function
  • Work vectors
  • Inheriting input and output port dimensions
  • Additional macros
Code Generation Considerations

Objective: Learn the procedures and limitations for automatically generating code with Real-Time Workshop when using the code integration methods described in the course.

  • Generating code from an Embedded MATLAB Function
  • Generating code from C MEX S-functions (Legacy Code Tool)
Code Integration Methods Review

Objective: Review the code integration methods and discuss the pros and cons of each.

  • Review of all methods of code integration
  • How to choose a code integration method

Prerequisites

Simulink for System and Algorithm Modeling, MATLAB Fundamentals, and knowledge of C programming

Course Length - 1 day

Request training