MATLAB and Simulink Training

Course Details

This one-day course presents multiple methods for integrating C code into Simulink® models. Topics discussed include the C Caller and C Function blocks, Legacy Code Tool for wrapping external C functions into Simulink, and manually written C MEX S-functions. This course is intended for intermediate to advanced Simulink users.

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 a MATLAB function in a MATLAB Function block
  • Converting a MATLAB function to a MATLAB Function block
  • MATLAB Function block coding standards

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 a MATLAB Function block

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: Explore the procedures and limitations for automatically generating code with Simulink Coder™.

  • Generating code from a MATLAB Function block
  • Generating code from C MEX S-functions (Legacy Code Tool)

Code Integration Methods Review

Objective: Review 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

Level: Intermediate

Prerequisites:

Duration: 1 day

Languages: Deutsch, English, 日本語, 한국어