MATLAB Creating Graphical User Interfaces

(Barry) #1
Automatically Refresh Plot in a GUIDE UI

Automatically Refresh Plot in a GUIDE UI


In this section...
“About the Example” on page 9- 79
“The Timer Implementation” on page 9- 81

About the Example


This example shows how to refresh a display by incorporating a timer in a UI that
updates data. Timers are MATLAB objects. Programs use their properties and methods
to schedule tasks, update information, and time out processes. For example, you can set
up a timer to acquire real-time data at certain intervals, which your UI then analyzes
and displays.

The UI displays a surface plot of the peaks function and contains three uicontrols:


  • The Start Randomizing push button — Starts the timer running, which executes
    at a rate determined by the slider control. At each iteration, random noise is added to
    the surface plot.

  • The Stop Randomizing push button — Halts the timer, leaving the surface plot in
    its current state until you click the Start Randomizing button again.

  • The Timer Period slider — Speeds up and slows down the timer, changing its period
    within a range of 0.01 to 2 seconds.

Free download pdf