Top Banner
HOME EE509 Fuzzy Logic and applications Building GUI interfaces in Matlab MATLAB This example shows how to build user GUI in Matlab. We will build a simple calculator to do that. Start gui builder by typing >>guide Select "Blank GUI", click OK The GUI window will open Designing GUI in Matlab http://www.intelligent-systems.info/classes/ee509/gui.htm 1 of 7 10/16/2015 9:08 PM
7

Designing GUI in Matlab

Jan 05, 2016

Download

Documents

m_omotayo

Matlab GUI Design Tutorial
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Designing GUI in Matlab

HOMEEE509

Fuzzy Logic and applications

Building GUI interfaces in Matlab

MATLAB

This example shows how to build user GUI in Matlab. We will build a simple

calculator to do that.

Start gui builder by typing

>>guide

Select "Blank GUI", click OK

The GUI window will open

Designing GUI in Matlab http://www.intelligent-systems.info/classes/ee509/gui.htm

1 of 7 10/16/2015 9:08 PM

Page 2: Designing GUI in Matlab

Resize the design window.

Using the pallette on the left, drag and drop, resize and position the canvas,

buttons, and static text windows.

Designing GUI in Matlab http://www.intelligent-systems.info/classes/ee509/gui.htm

2 of 7 10/16/2015 9:08 PM

Page 3: Designing GUI in Matlab

Double-click on an object to open the properties dialog. Change the captions on

the buttons and remove "Static Text" string from the text window. Set the font

size 30 for the text windows and change horizontal alingment to "right."

Designing GUI in Matlab http://www.intelligent-systems.info/classes/ee509/gui.htm

3 of 7 10/16/2015 9:08 PM

Page 4: Designing GUI in Matlab

The GUI is finished. Save the work.

The rest of the design process will take care of the functionality provided by each

GUI component.

Designing GUI in Matlab http://www.intelligent-systems.info/classes/ee509/gui.htm

4 of 7 10/16/2015 9:08 PM

Page 5: Designing GUI in Matlab

Open the matlab editor by typing

>>edit foo.m

where foo.m is the name of your design

Each time you press a button, a callback function is executed.

For example, in this particular case, a click on button "1" will call the following

function:

This function will have to be modified to provide required functionality.

Buttons "0"-"9","+","-","*","/" will add corresponding symbol to the text string

displayed on the top. For button "1" the code will look like:

Designing GUI in Matlab http://www.intelligent-systems.info/classes/ee509/gui.htm

5 of 7 10/16/2015 9:08 PM

Page 6: Designing GUI in Matlab

Do the same for the rest of the buttons, except "=".

The "=" button should evaluate the text string in the text window and return the

result.

Now the calculator is ready to use. Of course, it misses a lot of functionality, but

Designing GUI in Matlab http://www.intelligent-systems.info/classes/ee509/gui.htm

6 of 7 10/16/2015 9:08 PM

Page 7: Designing GUI in Matlab

BACK

TO

TOP

Last

Updated:

08/25/03

Contact the instructor at: [email protected]

Designing GUI in Matlab http://www.intelligent-systems.info/classes/ee509/gui.htm

7 of 7 10/16/2015 9:08 PM