Chapter 6 MATLAB GUI, Study notes of Matlab skills

MATLAB GUI (Graphical User Interface) Tutorial for Beginners ... In this Matlab GUI tutorial, you will learn how to create and use the slider component.

Typology: Study notes

2021/2022

Uploaded on 09/27/2022

linden
linden šŸ‡¬šŸ‡§

4.4

(8)

217 documents

1 / 68

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 6
Chapter
6
MATLAB GUI
MATLAB GUI (G hi l U I t f ) T t i l f B i
MATLAB
GUI
(G
rap
hi
ca
l
U
ser
I
n
t
er
f
ace
)
T
u
t
or
i
a
l
f
or
B
e
gi
nners
By J.S. Park
University of Incheon
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44

Partial preview of the text

Download Chapter 6 MATLAB GUI and more Study notes Matlab skills in PDF only on Docsity!

Chapter 6Chapter

MATLAB GUI

MATLAB GUI (G

hi

l U

I t

f^

) T t

i l f

B^

i

MATLAB GUI (Graphical User Interface) Tutorial for Beginners

By J.S. Park

University of Incheon

Preprocessing Data

p

g

Why use a GUI in MATLAB?It makes things simple for the end-users of the program.The command line interface Vs. GUIThe command line interface Vs. GUI

Initializing GUIDE (GUI Creator)

  1. You should now see the following screen.

Initializing GUIDE (GUI Creator)

  1. 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.

Creating the Visual Aspect of the GUI: Part 1

  1. Edit the properties of these components.

Double click one of the

Static Text components. You should see the

property Inspector.

p

p^

p^

y^

p

Creating the Visual Aspect of the GUI: Part 1

  1. Do the same for the next

Static Text component, but instead of changing the

String pa

rameter to +, change it to =, and another it to MyAdderGUI.4. For

Static Text component 0, modify the

Tag parameter to answer_staticText.

  1. You should have something that looks like

the following:

Creating the Visual Aspect of the GUI: Part 2

3.^

Modify the

pushbutton component.

Change the

String parameter to Add!

Change the

Tag parameter to add pushbutton.

Change the

Tag parameter to add_pushbutton.

Creating the Visual Aspect of the GUI: Part 2

  1. You should have something like this:

You should have something like this:

  1. Save your GUI under any file name you please. I chose to name mine myAdder.5. Save your GUI under any file name you please. I chose to name mine myAdder.

When you save this file, MATLAB automatically generates two files:

myAdder.fig and

myAdder.m.

The .fig file contains the graphics of your interface.The .m file contains all the code for the GUI.The .m file contains all the code for the GUI.

Writing the Code for the GUI Callbacks

  1. The cursor should take you to the following code block: 4. Add the following code to the bottom of that code block: 5. Add the same block of code to

input2_editText_Callback.

Writing the Code for the GUI Callbacks

  1. Now we need to edit the

add_pushbutton_Callback.

Here is the code that we will add to this callback:

Launching the GUI

  1. The GUI should start running immediately:

MATLAB GUI Tutorial - Slider

In this Matlab GUI tutorial, you will learn how to create and use the slider component.Sliders are useful controls for choosing a value in a range of values.Common uses are volume controls, seekers for movie and sound files as well as color picCommon uses are volume controls, seekers for movie and sound files as well as color pickers.An example of a slider is shown below.

Create the Visual Aspect of the GUI

  1. You should now see the following screen.

Creating the Visual Aspect of the GUI: Part 1 1.^ For the adder GUI, we will need the following components

Add

Edit T

t^

t t

th

GUI fi

Add an

Edit Text component to the GUI figure.

Add a

Slider component onto the GUI figure.