[help]Why use a GUI in MATLAB?[/help] The main reason GUIs are used is because it makes things simple for the end-users of the program. If GUIs were not used, people would have to work from the command line interface, which can be extremely difficult and fustrating. Imagine if you had to input text commands to operate your web browser (yes, your web browser is a GUI too!).
It wouldn?t be very practical would it? In this tutorial, we will create a simple GUI that will add together two numbers, displaying the answer in a designated text field.
This tutorial is written for those with little or no experience creating a MATLAB GUI (Graphical User Interface). Basic knowledge of MATLAB is not required, but recommended. MATLAB version 2007a is used in writing this tutorial. Both earlier versions and new versions should be compatible as well (as long as it isn’t too outdated). Lets get started!
Initializing GUIDE (GUI Creator)
First, open up MATLAB. Go to the command window and type in guide.
You should see the following screen appear. Choose the first option Blank GUI (Default).
You should now see the following screen (or something similar depending on what version of MATLAB you are using and what the predesignated settings are):
Before adding components blindly, it is good to have a rough idea about how you want the graphical part of the GUI to look like so that it’ll be easier to lay it out. Below is a sample of what the finished GUI might look like.