Introduction to Matlab’s Graphical User Interface (GUI) Type “guide” “Guide” creates interface on a Figure window and code in an M-file. Some hidden code.

Slides:



Advertisements
Similar presentations
Introduction to Macromedia Director 8.5 – Lingo
Advertisements

1 Microsoft Access 2002 Tutorial 9 – Automating Tasks With Macros.
DATA RETRIEVAL AND GUI CREATION DAVID COOPER SUMMER 2014.
A graphical user interface (GUI) is a pictorial interface to a program. A good GUI can make programs easier to use by providing them with a consistent.
Automating Tasks With Macros
1 How to create GUI's in MatLAB Rigo Dicochea. 2 Introduction Graphical User Interface (GUI) MatLab provides Graphical User Interface Development Environment(GUIDE)
Get number The ginput command creates crosshairs. When the user clicks the x,y values of the crosshairs are returned.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
CS112 Scientific Computation Department of Computer Science Wellesley College Interactive Programs Graphical User Interfaces.
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
Matlab GUIs Making Matlab Interactive. Today’s topics What is a GUI? How does a GUI work? Where do you begin? Ways to build MATLAB GUIs.
Saving and Loading Simple Text Files A sequential file stores characters one after the other like songs on a cassette tape. New characters are added to.
Programming a GUI Hanan sedaghat pisheh. For calling GUI, we need a function with no inputs or outputs First We create a m.file m file has the same name.
ME 392 ME January 2012 Week 3 Joseph Vignola.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
From BlueJ to NetBeans SWC 2.semester.
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
Using Dreamweaver. Slide 1 Dreamweaver has 2 screens that do different things The Document window where you create your WebPages The Site window where.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
A short intermission about function handles and cell arrays A MATLAB function may be referenced by a handle. >> sphere(100)
Introduction to the Graphical User Interface (GUI) in MATLAB
Matlab GUIs GUIDE.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Written by: Itzik Ben Shabat Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab.
Introduction to Matlab & Data Analysis
ACCESS Part 2. OBJECTIVES  Use the Form Wizard  Create a split form  Use Form Layout View  Add fields to a form  Modify form controls  Create calculations.
Chapter 10 Fireworks: Part II The Web Warrior Guide to Web Design Technologies.
Alice 2.0 Introductory Concepts and Techniques Project 1 Exploring Alice and Object-Oriented Programming.
GUI development with Matlab: GUI Front Panel Components 1 GUI front panel components In this section, we will look at -GUI front panel components -Programming.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Seven More on the Repetition Structure.
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
MA/CS 3751 Fall 2002 Lecture 24. MA/CS 3752 ginput ginput is a Matlab function which takes one argument input: number of points to select in the image.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room , Chris Hill, Room ,
Graphical User Interfaces I The central station is the bubble gum planet with 280 pounds of clay and three head phone lines that come out and orbit the.
Introduction to MATLAB Damon Tomlin February 22, 2008 Lecture 3: Data Visualization & User Interfaces.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
Visual Basic.NET BASICS Lesson 3 Events and Code.
Graphical User Interfaces Tonga Institute of Higher Education.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
SUNY-New Paltz Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz “Lecture 9”
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Introduction to Matlab & Data Analysis 2015 In this tutorial we will: Build a practical application using GUIDE Learn more about graphical user interface.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
GUI development with Matlab: GUI Front Panel Components GUI development with Matlab: Other GUI Components 1 Other GUI components In this section, we will.
The Hong Kong Polytechnic University Industrial Centre 1 MatLAB Lesson 9 : Introduction to GUI & Revision Edward Cheung Room W311g.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
XP Tutorial 8 New Perspectives on Microsoft Windows XP 1 Microsoft Windows XP Object Linking and Embedding Tutorial 8.
CS112 Scientific Computation Department of Computer Science Wellesley College Interactive Programs Graphical User Interfaces.
EGR 115 Introduction to Computing for Engineers
Compare and Contrast : Blackboard & a Personal Web Page www3.ltu.edu/~s_schneider/howto/faculty.htm You’ll find this presentation (and another) here :
Introduction to Matlab Module #10 Page 1 Introduction to Matlab Module #10 – Creating Graphical User Interfaces Topics 1.Overview of GUI Development using.
Graphical User Interfaces I The central station is the bubble gum planet with 280 pounds of clay and three head phone lines that come out and orbit the.
Lecture (7) Introduction to GUI Eng. Osama Talaat 1.
Data Analysis GUI Documentation guide. Terminology GUI – Graphical User Interface Log-File – File containing data of interest which is generated by user’s.
MATLAB and SimulinkLecture 61 To days Outline Graphical User Interface (GUI) Exercise on this days topics.
PATTERN RECOGNITION LAB 8 TA : Nouf Al-Harbi::
Written by: Itzik Ben Shabat Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab.
Chapter 3: I Need a Tour Guide (Introduction to Visual Basic 2012)
Graphical User Interfaces I
Reading and Writing Image Files
Graphical User Interface in MATLAB
Multiple Classes and Inheritance
Introduction to Basic Interface of
More on Graphical User Interfaces
MATLAB GUI with GUIDE 報告人:張捷勝.
Presentation transcript:

Introduction to Matlab’s Graphical User Interface (GUI) Type “guide” “Guide” creates interface on a Figure window and code in an M-file. Some hidden code. The M-file and the Figure window usually have the same name. We add “objects” in the “Layout editor” and complete “Callback functions” in M-file editor.

Try it. Type “guide”. The layout window appears. Add a slider and an edit text box. We want the text to represent the “value” of the slider. Right click in the slider, go down to “view callbacks”, and select “Callback”

Try it. You are invited to save the untitled document and then taken to an M-file editor, with the start of you callback function already written. Notice that the M-file has the same name as the figure.

Handles The main figure has a “handle” in the Matlab environment. Handles allow Matlab to keep track of figures and graphic objects. Within the main figure each of our objects (the slider and the text box) also have a handle. Child objects.

Handles We differentiate between or identify objects by their handle. Matlab has functions to keep track of and list these gui handles. Run the M-file by typing “h= ”. It doesn’t do much yet! Don’t confuse the Figure with the Layout editor.

Handles The handle of the figure is returned in variable “h”. Although “h” only admits to being a double, it gives us access to all the properties of the figure. get(h) returns a copy of the figure’s (object’s) properties including its children. The “children” are the objects that we have placed on the figure: slider and edit text.

Handles, Try it Type “maindetails=get(h)” maindetails lists all the properties in the figure. The structure includes handles to the child objects. We can use the handles to gain access to the child objects and alter their properties.

Properties, get() and set() We can retrieve a copy of the values associated with a graphic object through its handle by using S=get(h) The structure contains all the properties of the graphic object. However, since it is a copy we cannot change the actual information associated with the graphic object.

Properties, get() and set() So in true “OO’” style we must use an access method/function to adjust parameters.. Set(h,'PropertyName',Propert yValue) Get(h) or Get(h, ‘PropertyName’) returns the property. Note ‘quotes’

Properties, get() and set() Alter the ‘visible’ property of the slider using the handles to the child objects of your gui. Put it back to what it was. You will need to get the child handles array from the main gui and use set to change the visible property.

Example g=test get(g) cld=get(g.Children) cld=get(g, 'Children') set(cld(1), 'Visible', 'off') set(cld(1), 'Visible', 'on')

Reference to objects In the GUI an object’s handles are passed to the callback function in the variable hObject. Also, the self generated code produces a list of all objects handles in the structure “handles” (see later).

Other callbacks CreateFcn DeleteFcn ButtonDownFcn More….

Guihandles() This function returns an structure of handles of all handle in the gui. It passes the structure to your callback function in the variable “handles” So we can access other objects through this structure. handles.edit1 for example gives us the handle of the edit box.

Write some callbacks Write a call back to display the slider’s position in the edit box. Do the same, but make the slider move (‘value’) when a value between 0 and 1 is entered in the edit window.

Properties we need We want to display the value of the slider in the edit box. So we need something to retrieve the value from the slider. And we need something to give the value to the edit box.

Properties we need We use slider ‘value’ And edit text ‘string’. Also need string conversion from num2str and str2num

Examples In the slider1 callback get(hObject, 'Value') set(handles.edit1, 'String', num2str(v)) In the edit1 callback s=get(hObject, 'String') set(handles.slider1, 'Value', str2num(s))

Plot picture to axis Image(a) will send an image to the current axis You may need –gca Get current axes –axes Set current axes

Lets load a picture Place an axes on your form. Place a button which is going to load and display a picture. Write the callback.

Example In button1 callback im=imread('test2.bmp'); image(im)