How to create a simple graphical user interface in Matlab

Table of contents:

How to create a simple graphical user interface in Matlab
How to create a simple graphical user interface in Matlab
Anonim

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

Steps

Build a Simple Graphical User Interface in MATLAB Step 1
Build a Simple Graphical User Interface in MATLAB Step 1

Step 1. Open the Matlab program and wait for it to load

Build a Simple Graphical User Interface in MATLAB Step 2
Build a Simple Graphical User Interface in MATLAB Step 2

Step 2. Click on “Matlab” on the platform to expand the list and then click on “GUIDE (GUI Builder)”

If you can't see the platform, click View, followed by Launchpad. The GUI generator will appear.

Build a Simple Graphical User Interface in MATLAB Step 3
Build a Simple Graphical User Interface in MATLAB Step 3

Step 3. Click the "Ok" button on the left side of the window

That will allow you to drag and drop button.

Build a Simple Graphical User Interface in MATLAB Step 4
Build a Simple Graphical User Interface in MATLAB Step 4

Step 4. Move the mouse anywhere in the gray area in the center of the window

Build a Simple Graphical User Interface in MATLAB Step 5
Build a Simple Graphical User Interface in MATLAB Step 5

Step 5. Click the button and hold the mouse down dragging it until this shape is the size you want

Build a Simple Graphical User Interface in MATLAB Step 6
Build a Simple Graphical User Interface in MATLAB Step 6

Step 6. Release the mouse and you will see a button appear

Build a Simple Graphical User Interface in MATLAB Step 7
Build a Simple Graphical User Interface in MATLAB Step 7

Step 7. Double click the button you created

An administrator will appear.

Build a Simple Graphical User Interface in MATLAB Step 8
Build a Simple Graphical User Interface in MATLAB Step 8

Step 8. Locate the "string field" and click in the area to the right of it, type "Say Hello."

Now change the label to "button".

Build a Simple Graphical User Interface in MATLAB Step 9
Build a Simple Graphical User Interface in MATLAB Step 9

Step 9. Find the button on the left called “txt” and follow the same instructions from step 8

Build a Simple Graphical User Interface in MATLAB Step 10
Build a Simple Graphical User Interface in MATLAB Step 10

Step 10. Now click on the file then save your work

This will also open a code for your program.

Build a Simple Graphical User Interface in MATLAB Step 11
Build a Simple Graphical User Interface in MATLAB Step 11

Step 11. Locate the line of code in the code editor that says “function varargout = pushbutton1_Callback (h, eventdata, handles, varargin)”

This is the return function. Here we will make the text in the textbox change when the user clicks the button.

Build a Simple Graphical User Interface in MATLAB Step 12
Build a Simple Graphical User Interface in MATLAB Step 12

Popular by topic