How to create GUI's in MatLAB

Rigo Dicochea

Introduction       Graphical User Interface (GUI) MatLab provides Graphical User Interface Development Environment(GUIDE) A MatLab tool used to create GUI’s Decide between using GUIDE or writing the code from scratch GUI’s give the user a simplified experience running a program Associates a “function(s)” with components of the GUI 2 .

Graphical User Interface    GUI should be consistent and easily understood.etc 3 Sample GUI . Provide the user with the ability to use a program without having to worry about commands to run the actual program Possible components of a GUI – – – – Pushbuttons Sliders List boxes Menus….

sliders. etc… Frames. edit boxes.… – Static Components  – Both are created using the function uicontrol   Figures – components are contained in figures Callbacks – The functions which perform the required action when a component is pushed 4 . menus.3 Essential Characteristics  Components – – Graphical Components  pushbuttons. text strings. labels.

fig file .GUIDE Properties     Allows the user to drag and drop components that he/she wants in the “layout” area of the GUI All “guide” GUI’s start with an opening function – Callback is performed before user has access to GUI Saving automatically generates an .m contains the code that controls the GUI 5 .m file and .fig contains the binary GUI layout and .

6 .Assessing the Value of Your GUI  Ask yourself two basic questions when designing your GUI. – Do the users always know where they are? – Do they always know where to go next?  Constantly answering these two questions will help you keep in perspective the goal of your GUI.

Callback Editor The “meat” of the GUI process  Opening function is first callback in every “guide” generated GUI  Usually used to generate data used in GUI  Callbacks define what will happen when a figure component is selected  Must write CODE!!!!  7 .

obtained by translating and scaling Gaussian distributions – Peaks  – Membrane – Sinc  sinc computes the sinc function of an input vector or array. Contour  Types of plots performed on data in example peaks is a function of two variables. Mesh.GUI EXAMPLE  Utilize functions – Surf. where the sinc function is 8 .

Summary     At command prompt type “guide” After laying out your GUI in the layour editor Define data in Opening Function Edit/Align your components using – Tools Menu  Align Property Inspector – View menu   Write the Callbacks – This is the most difficult aspect when creating GUI’s 9 . /techdoc/creating_guis/creating_guis.mathworks.mathworks.mathworks.mathworks.html change/ file http://www.html?BB=1 Daniel Keller – thanks for taking time to help! 10 .com/products/matlab/ www.Where to Get More Information       /techdoc/ref/peaks.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.