MATLAB || Simulink || code generation workflow|| Part 22 || Model tuning
Understanding Model Changes in MATLAB
Introduction to the Tutorial
- The tutorial focuses on how changes in a model impact the generated code, emphasizing code reusability and function types.
- Previous tutorials covered creating plant models, controller models, test harnesses, and understanding callbacks on model properties.
Modifying the Model
- The presenter demonstrates modifying an existing state flow chart by creating a group subchart for the "on State," which contains multiple substates.
- A subsystem is created within the model hierarchy, similar to Simulink's functionality.
Changing Function Properties
- The working state is changed from inline to function type through its properties menu.
- After building the model and generating C code, a new function named "working" appears in the output file due to this property change.
Observing Code Generation Effects
- The presenter shows how to locate the newly created function definition in the generated C code.
- By reverting back to inline settings for the working block, it’s demonstrated that no separate function will be created upon regeneration of C code.
Conclusion and Engagement
- This section highlights how controlling function creation can be achieved by adjusting model properties according to specific requirements.