1 What is guide

MATLAB is a scientific computation software and is very friendly, because it provides us many useful data processing functions. If you are not familiar with it, however, this may cost some time to learn about it. Fortunately, MATLAB prepare a GUI tool for us, called guide. guide provides us point-and-click of MATLAB applications, and you can share these applications within MATLAB or as a desktop application.

2 The first glimpse of guide

Suppose that you have installed MATLAB and just type guideand press enter in the command prompt window and you will see this.

type guide

One should notes that the language of my MATLAB interface is Chinese and these option positions of the English version interface are the same as the Chinese version.

3 Create our first GUI app

Now we want to create our first guide app. These are several steps before we go into the GUI design world.

  • 1 Click “create new GUI”;
  • 2 Choose a blank GUI;
  • 3 You can choose to save this GUI file;
  • 4 Press yes to finish our settings.

settings

There comes the GUI interface and a corresponding MATLAB file.

new GUI

We will show you how to add a push button on our GUI and some information can be printed in the command prompt window you push the button.

4 The first widget: button

  • 1 Choose the button option to add a push button;
  • 2 Double-click on chosen button and a GUI setting interface will appear;
  • 3 Set the background color (optional);
  • 4 Set font size (optional);
  • 5 Set font style (optional);
  • 6 Set a string displayed on the button if necessary;
  • 7 Change the handle name of the button and this is important because it locates the callback function of this button;
  • 8 Press save on the GUI file (untitled.fig) and the callback function will appear in the corresponding MATLAB file (untitled.m);
  • 9 Implement this callback function and it will be executed when you run the GUI app.

button

5 Run the GUI app

Run this GUI app and push the button, and the string The button was pressed! will be displayed in the command prompt window.

run it

Here we introduce a very simple demo of creating a guide GUI, and we will show you how to add more widgets on the GUI app in next parts. Enjoy it!.