File Exchange

image thumbnail

Simulink-GUI Synchronization Example

version (15.6 KB) by

Demonstrates how to synchronize GUI and Simulink model settings when user alters one or the other

9 Ratings



View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Developing Graphical User Interfaces that drive Simulink models is a relatively common practice that can be accomplished with calls to get_param, set_param, and other Simulink functions. However, it can be challenging to update settings in the GUI when the user opts to alter them in the model directly rather than working through the GUI. This can lead to mismatches in settings in the model and values in the GUI.
This example demonstrates certain techniques to accomplish synchronization between a model and GUI. Through the use of Model and Block callbacks, we will be able to
1) Automatically open/close a GUI when opening/closing a model.
2) Update a pushbutton string when the user pushes Play in Simulink.
3) Update a pushbutton string when the simulation stops or the user pushes the Stop simulation button in Simulink.
4) Update a checkbox value when a Manual Switch is updated in Simulink.

In this manner, we enable the user to make changes through the GUI or directly within Simulink without causing mismatches between the two. Commentary, annotation, and a readme are provided to further explain how this is accomplished.

Comments and Ratings (10)

Irad Leiser



tiff (view profile)


Suytry KY

Ali Osman


Hao Huang




Updated license


Fixed minor mistakes in hastily uploaded file.


Added a Gain block that can be controlled via Edit Box and/or Slider


Use findobj instead of referencing GUI objects by children index.


Updated to R2009b

MATLAB Release
MATLAB 7.9 (R2009b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video