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

 

Training - Courses

SLEX: Integrating Code with Simulink

Note: A 1 hour test session will be scheduled one day prior to the first day of class. This session is to verify that the visual and audio connection is working properly on your computer. The required product software should be installed for the test session. It is highly recommended that you attend this session to ensure a successful and timely class start.

This one-day course presents multiple methods for integrating code into Simulink® models. The focus is on integrating C and MATLAB®. 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
Introduction

Objective: Obtain a quick overview of The MathWorks and discuss course logistics.

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
ConclusionObjective: Find resources for further information and training on the topic. Evaluate the class.

Prerequisites

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

Course Length - 1 day

Request training