Book Name: MATLAB Creating Graphical User Interfaces PDF
Category: MATLAB
Language: English
Format: PDF
Free Download: Available

MATLAB Creating Graphical User Interfaces | PDF Free Download. 

Book Details :
Language English
Pages 500
Format PDF
Size 6.26 MB

MATLAB Creating Graphical User Interfaces PDF 

Creating Graphical User Interfaces Matlab Version 7 pdf

MATLAB Creating Graphical User Interfaces Contents

  • What Is a UI?
  • Create a Simple UI Using GUIDE 
  • Create a Simple UI Programmatically
  • GUIDE: Getting Started
  • GUIDE Preferences 
  • GUIDE Templates
  • Save a GUIDE UI 
  • Write Callbacks Using the GUIDE Workflow
  • Modal Dialog Box in GUIDE 
  • Structure of Programmatic UI Code Files
  • Initialize a Programmatic UI
  • Share Data Among Callbacks 
  • Interrupt Callback Execution 
  • Axes, Menus, and Toolbars in Programmatic UIs
  • Find Apps 

Introduction to MATLAB Creating Graphical User Interfaces PDF

What Is a UI?

A user interface (UI) is a graphical display in one or more windows containing controls, called components, that enable a user to perform interactive tasks.

To accomplish the tasks, the user does not have to create a script or type commands at the command line. Unlike coding programs to accomplish tasks, the user does not need to understand the details of how the tasks are performed.

UI components can include menus, toolbars, pushbuttons, radio buttons, list boxes, and sliders—to name a few. UIs created using MATLAB® tools can also perform any computation, read and write data files, communicate with other UIs, and display data as tables or as plots.

The following figure illustrates a simple UI that you can easily build yourself.

The UI contains these components:

• An axes component

• A pop-up menu listing three data sets that correspond to MATLAB functions: peaks, membrane, and since

• A static text component to label the pop-up menu

• Three buttons that provide different kinds of plots: surface, mesh, and contour

When you click a push-button, the axes component displays the selected data set using the specified type of 3-D plot.

How Does a UI Work?

Typically, UIs wait for a user to manipulate a control, and then respond to each user action in turn. Each control, and the UI itself, has one or more callbacks, named for the fact that they “call back” to MATLAB to ask it to do things.

A particular user action, such as pressing a screen button, or passing the cursor over a component, triggers the execution of each callback. The UI then responds to these events. As the UI creator, you write callbacks defining what the components do to handle events.

This kind of programming is often referred to as event-driven programming. In event-driven programming, callback execution is asynchronous, that is, events external to the software trigger callback execution.

In the case of MATLAB UIs, most events are user interactions with the UI, but the UI can respond to other kinds of events, such as creating a file or connecting a device to the computer.

You can code callbacks in two distinct ways:

• As MATLAB language functions stored in files

• As strings containing MATLAB expressions or commands (such as ‘c = sqrt(a*a + b*b);’or ‘print’)

Using functions stored in code files as callbacks are preferable to using strings because functions have access to arguments and are more powerful and flexible.

You cannot use MATLAB scripts (sequences of statements stored in code files that do not define functions) as callbacks. Although you can provide a callback with certain data and make it do anything you want, you cannot control when callbacks execute.

That is, when your UI is being used, you have no control over the sequence of events that trigger particular callbacks or what other callbacks might still be running at those times.

This distinguishes event-driven programming from other types of control flow, for example, processing sequential data files.

Ways to Build MATLAB UIs

A MATLAB UI is a figure window to which you add user-operated components. You can select, size, and position these components as you like.

Using callbacks you can make the components do what you want when the user clicks or manipulates the components with keystrokes.

You can build MATLAB UIs in two ways:

Create the UI using GUIDE

This approach starts with a figure that you populate with components from within a graphic layout editor.

GUIDE creates an associated code file containing callbacks for the UI and its components. GUIDE saves both the figure (as a FIG-file) and the code file. You can launch your application from either file.

Create the UI programmatically

You create a code file that defines all component properties and behaviors using this approach. When a user executes the file, it creates a figure, populates it with components, and handles user interactions. Typically, the figure is not saved between sessions because the code in the file creates a new one each time it runs.

The code files of the two approaches look different. Programmatic UI files are generally longer because they explicitly define every property of the figure, its controls, and the callbacks. GUIDE UIs define most of the properties within the figure itself.

They store the definitions in its FIG-file rather than in its code file. The code file contains callbacks and other functions that initialize the UI when it opens.

You can create a UI with GUIDE and then modify it programmatically. However, you cannot create a UI programmatically and then modify it with GUIDE.

Your chosen approach depends on your experience, preferences, and goals. Here are some ways to achieve specific goals.


Download MATLAB Creating Graphical User Interfaces in PDF Format For Free. 


Buy From Amazon

Related More Books
Thanks For Visiting Our Website To Support Us, Keep Share On Social Media.