17
MATLAB GUI Tutorial Presented By : Shailie Rai

MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

Embed Size (px)

Citation preview

Page 1: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

MATLAB GUI Tutorial

Presented By:

Shailie Rai

Page 2: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

2

CONTENTIntroduction

Steps used to build a GUI

Conclusion

Page 3: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

3

Introduction to Graphical User Interface (GUI)

It allows the use of icons or other visual indicators to interact with electronic devices, rather than using only text via the command line.

Many tools can be added to the layout area like Push buttons, Edit text, Static text, Axes etc.

Page 4: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

4

Steps used to build the GUI

In the Matlab command window write GUIDE then press enter.

Then the following dialog box appears.

Press OK then continue.

Page 5: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

5

In the GUI window you can add different types of tools.

This can be done by selecting tools from the component palette at the left side of the Layout Editor and then drag them into the layout area.

Page 6: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

6

As I have selected following tools from the palette to develop my program :

AXES PANEL STATIC TEXT EDIT TEXT PUSH BUTTON

Page 7: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

7

I have repeated this step until desired number of tools were obtained in the layout area.

Page 8: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

8

Then double click each tool to get the property inspector to edit the varies properties of tools eg. PANEL , STATIC TEXT Property Inspector.

Changed the title for Panel as Data

Changed the colour to Red

Changed the Font size to 10.0

Page 9: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

9

Delete this and write the desired text

Page 10: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

10

And here is the final generated GUIWhen we run the GUI a MATLAB .m file is created along with the fig file

Page 11: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

11

Any action that takes place depends upon an event that is occurred on a particular control (tool), for example :

Click on a pushbutton Pressing Enter/Return after entering data into an edit

boxIn a GUI a piece of code or function that executes in

response to events on the tools are called callbacks.To develop the callback function for the push-button

“Carrier1_edit2_Callback”, in the program right click the control to open the context menu , then select

view callbacks --------> callback

Page 12: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

12

Generating callback in the program

Page 13: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

13

Callback generated

Start writing the code after the comments and repeat this process for the callbacks of different tools as per requirement.

Page 14: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

14

Execution of GUI

Page 15: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

15

Entering the required fields and clicking on the FSK push button required plot is generated and similar steps are followed for the ASK , PSK push button.

Page 16: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

16

Conclusion

GUI helps to make the program interactive to the user so that one can use various tools provided in the Matlab GUI interface to get the desired layout area.

Page 17: MATLAB Graphical User Interface (GUI) Tutorial Presented by SHAILIE RAI

17

THANK YOU