Build a Simple Graphical User Interface in MATLAB

Matlab is a powerful mathematical tool for matrix calculations and almost any other mathematical function you need. Matlab also has the ability to form windows like applications with its programming language.

Steps

  1. Open the Matlab Program and wait for it to finish loading
  2. Click on "MATLAB" in the launch pad to expand the list and then double click on "GUIDE (GUI Builder)". If you cannot see the launch pad, click on view followed by launch pad. The GUI builder will appear
  3. Click on the "ok" button in the left hand side of the window. This will allow you to drag and drop a pushbutton.
  4. Move the mouse to somewhere on the grey area in the center of the window.
  5. Click once and hold down the button and drag your mouse until the square that this forms is of the size you'd like
  6. Release the mouse button and you will see your push button appear
  7. Double click on the pushbutton you just created. A property manager will pop up
  8. Locate the "string field" and click the area to the right of it and type "Say Hello". Also Change the Tag to "button"
  9. Find the button on the left labeled "txt" and follow the same step 8 again
  10. Now click on file then save to save your work. This will also pop up the code for your program.
  11. Locate the line of code in the code editor that says function varargout = pushbutton1_Callback(h, eventdata, handles, varargin). This is the callback function. Any code below this will be executed whenever the user pushes the button. Here we will make this change the text in the text box when the user clicks on the button
  12. Write set.



Related Articles

Sources and Citations