Appendix B

GUI Development

B.1 Introduction

In this appendix, we provide a practical guide to develop graphical user interfaces, or GUIs, for MATLAB applications. This walk-through will give you the general idea of how a user interface works in MATLAB, from laying out the window in code to passing data around your application. We will refer to an example GUI throughout the appendix so that you can see the concepts in action.

First, we will look at the basic structure of the code that makes up a GUI. This is important because the structure of the code is related to its function, as we will see later. We will also take a look at how the control of the system is passed between MATLAB and the functions that make up a GUI. This will allow you to implement a fancy dynamic application, even though MATLAB executes code sequentially. Next, we will inspect the method by which data are saved in the GUI and how those data are passed around so that all necessary functions have access to them. Finally, we will dissect a working GUI demo that will wrap up all the concepts covered as well as solidify them.

B.2 GUI File Structure

The file that makes up a GUI interface is nothing more than an M-file. The typical uses of an M-file you have most likely seen so far are to save code in a script or create a stand-alone file, or a function, that performs a particular task. A GUI M-file is a lot like a function in that it performs one task: create and execute your GUI. It differs, however, from a function ...

Get Practical Image and Video Processing Using MATLAB® 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.