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
- Open the Matlab Program and wait for it to finish loading
- 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
- Click on the "ok" button in the left hand side of the window. This will allow you to drag and drop a pushbutton.
- Move the mouse to somewhere on the grey area in the center of the window.
- Click once and hold down the button and drag your mouse until the square that this forms is of the size you'd like
- Release the mouse button and you will see your push button appear
- Double click on the pushbutton you just created. A property manager will pop up
- Locate the "string field" and click the area to the right of it and type "Say Hello". Also Change the Tag to "button"
- Find the button on the left labeled "txt" and follow the same step 8 again
- Now click on file then save to save your work. This will also pop up the code for your program.
- 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
- Write set.
Related Articles
- Make a GUI Grid in Java
- Create a Swing GUI in Java
- Create a GUI Page and Add Controls
- Use the Command Line Interface
- Install a New Microsoft CD