images

12.1    Waitbars

12.2    File dialogs

12.3    Reading and writing formatted text files

12.4    The input dialog

12.5    The question dialog

12.6    Sharing application data between functions

12.7    Responding to keyboard input

12.8    Making graphic objects interactive

12.9    Creating menus in GUIDE

This chapter covers several techniques you can use to make your GUI tools more interactive and helpful. Like the chapters that follow, it is meant as a resource and reference rather than a tutorial.

GUI pop-ups. MATLAB comes with a variety of small predefined GUI tools in the form of ready-to-go dialog boxes and pop-up tools. These can be added to your own GUI tools to enhance their functionality.

Waitbars Waitbar pop-ups show the user how much progress has been made toward the completion of a computational task. The key MATLAB command is waitbar. (Section 12.1).

File dialogs To save information to a MATLAB-formatted *.mat file, one can conveniently use a combination of the save command and the uiputfile command, which pops up a familiar file navigation tool. To read information from a file, one can use load and uigetfile (Section 12.2) Writing and reading from formatted text files is a little more complicated and can be accomplished using the commands fopen, fprintf, and textscan (Section 12.3).

Input dialogs The pop-up produced by the inputdlg command allows the user to enter specific ...

Get Learning to Program with MATLAB: Building GUI Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.