Code covered by the BSD License  

Highlights from
Simulink-GUI Synchronization Example

Be the first to rate this file! 70 Downloads (last 30 days) File Size: 15.58 KB File ID: #26308
image thumbnail

Simulink-GUI Synchronization Example

by Will Campbell

 

07 Jan 2010 (Updated 25 Feb 2010)

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

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

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.

Required Products Simulink
MATLAB release MATLAB 7.9 (2009b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
02 Feb 2010

Updated to R2009b

22 Feb 2010

Use findobj instead of referencing GUI objects by children index.

25 Feb 2010

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

25 Feb 2010

Fixed minor mistakes in hastily uploaded file.

Tag Activity for this File
Tag Applied By Date/Time
simulink Will Campbell 02 Feb 2010 10:10:30
gui Will Campbell 02 Feb 2010 10:10:30
gui example Will Campbell 02 Feb 2010 10:10:31
graphical user interface Will Campbell 02 Feb 2010 10:10:31
potw Shari Freedman 26 Feb 2010 09:35:10
graphical user interface Panneer Selvam 14 Sep 2010 06:55:01
pick of the week Jiro Doke 11 Feb 2011 20:07:51

Contact us at files@mathworks.com