MATLAB Examples

Interface Simulink Bus Signals and Integrate Custom C Code

This example shows how to interface Simulink® bus signals with a Stateflow® chart. It also demonstrates how to:

  • Define Stateflow data of structure type using Simulink.Bus objects.
  • Integrate custom C code with structure typed data.

In this model, both inbus and outbus are bus signals used in Stateflow. Both variables are defined as bus objects of type COUNTERBUS, a bus type that was created in the Bus Editor. This bus type is stored in the bus_objects.mat file, which is loaded in the model as a PreLoadFcn callback function.