MATLAB and SimulinkLecture 61 To days Outline Graphical User Interface (GUI) Exercise on this days topics.

Slides:



Advertisements
Similar presentations
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Advertisements

Designing a Graphical User Interface (GUI) 10 IST – Topic 6.
Working with Tables for Page Design – Lesson 41 Working with Tables for Page Design Lesson 4.
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.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
1 How to create GUI's in MatLAB Rigo Dicochea. 2 Introduction Graphical User Interface (GUI) MatLab provides Graphical User Interface Development Environment(GUIDE)
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
A Guide to Oracle9i1 Creating an Integrated Database Application Chapter 8.
MENUS AND THE MENU EDITOR Elements of a Menu Menu bar Menu title Separator bar Menu items.
3D Game Programming All in One By Kenneth C. Finney.
Introduction To Form Builder
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.
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.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
1 Forms A form is the usual way that information is gotten from a browser to a server –HTML has tags to create a collection of objects that implement this.
6 Copyright © 2004, Oracle. All rights reserved. Working with Data Blocks and Frames.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
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.
Chapter 8: Writing Graphical User Interfaces
Introduction to Matlab & Data Analysis
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
Chapter 8: Writing Graphical User Interfaces Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 10 Fireworks: Part II The Web Warrior Guide to Web Design Technologies.
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.
3461A Readings from the Swing Tutorial. 3461A Overview  The follow is the Table of Contents from the trail “Creating a GUI with JFC/Swing” in the “The.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
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.
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.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
1 Chapter Nine Using GUI Objects and the Visual Studio IDE.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Introduction to Matlab & Data Analysis 2015 In this tutorial we will: Build a practical application using GUIDE Learn more about graphical user interface.
GUI Programming using NetBeans. RHS – SOC 2 GUI construction We have previously talked about elements in a (simple) GUI –Frames, Panes and Dialogs –Text.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Visual Basic Programming Introduction VB is one of the High level language VB has evolved from the BASIC language. BASIC stands for Beginners All-purpose.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 – Graphical User Interfaces Java Foundations: Introduction to Programming.
GUI development with Matlab: GUI Front Panel Components GUI development with Matlab: Other GUI Components 1 Other GUI components In this section, we will.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
Lec 16 Chapter 10 Nov 2, 11 Chapter 10, user interface design examples.
The Hong Kong Polytechnic University Industrial Centre 1 MatLAB Lesson 9 : Introduction to GUI & Revision Edward Cheung Room W311g.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
Creating User Interfaces Chapter 13 CSCI CSCI 1302 – Creating User Interfaces2 Outline Introduction Common Features of Swing GUI Components Buttons.
CS112 Scientific Computation Department of Computer Science Wellesley College Interactive Programs Graphical User Interfaces.
EGR 115 Introduction to Computing for Engineers
INFORMATION SYSTEM – SOFTWARE TOPIC: GRAPHICAL USER INTERFACE.
Creating Menus Menu Bar – behaves like standard Windows menus Can be used in place of or in addition to buttons to execute a procedure Menu items are controls.
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.
Chapter 5 Introduction To Form Builder. Lesson C Objectives  Use sequences to automatically generate primary key values in a form  Create lists of values.
PATTERN RECOGNITION LAB 8 TA : Nouf Al-Harbi::
More Matlab Graphics and GUI Graphics subplots some useful commands 3D graphics GUI GUI controls The callback property Other essential properties.
Graphical User Interfaces I
Topics Graphical User Interfaces Using the tkinter Module
Graphical User Interface in MATLAB
Chapter Topics 15.1 Graphical User Interfaces
Chapter 8: Writing Graphical User Interfaces
Chap 7. Building Java Graphical User Interfaces
More on Graphical User Interfaces
Graphical User Interfaces -- Introduction
Chapter 15: GUI Applications & Event-Driven Programming
Creating Additional Input Items
Chapter 4 Enhancing the Graphical User Interface
Presentation transcript:

MATLAB and SimulinkLecture 61 To days Outline Graphical User Interface (GUI) Exercise on this days topics

MATLAB and SimulinkLecture 62 Graphical User Interface (GUI) Can make programs easier to use by providing them with: Pushbuttons List boxes Sliders Menus Etc

MATLAB and SimulinkLecture 63 Graphical User Interface (GUI) The GUI should behave in an understandable and predictable manner. GUI’s are event driven A event could be a mouse click or a key press.

MATLAB and SimulinkLecture 64 Graphical User Interface (GUI) Three principal elements required to create a MATLAB GUI: 1. Components.Each item in a GUI is a graphical component. Controls: Pushbuttons, edit boxes, sliders etc. Static elements: Frames and text strings Menus Axes

MATLAB and SimulinkLecture 65 Graphical User Interface (GUI) 2. Figures: The components must be within a figure window. 3. Callbacks: The GUI must perform some kind of action if a user clicks the mouse on a button or the keyboard. (event) The code executed in response to an event is known as a callback. There must be a callback to each graphical component on the GUI.

MATLAB and SimulinkLecture 66 Graphical User Interface (GUI)

MATLAB and SimulinkLecture 67 Graphical User Interface (GUI) The basic steps to create a MATLAB GUI 1. Decide what elements are required and what function of each element. Draw a rough layout on paper. 2. Use the MATLAB tool: Graphical user interface development tool, guide. To layout all components on a figure. 3. Use a MATALB tool called: Property Inspector to set a name (a tag), color etc.

MATLAB and SimulinkLecture 68 Graphical User Interface (GUI) 4. Save the figure to a file. When the figure is saved, two files will be created on the disk with the same name but with different extension. filename.fig and filename.m The fig contains the created GUI. The m-file contains the code to load the figure and skeleton callbacks for each GUI element. 5. Write code to implement the behavior associated with each callback function

MATLAB and SimulinkLecture 69 Graphical User Interface (GUI) GUIDE

MATLAB and SimulinkLecture 610 Graphical User Interface (GUI) Property inspector Property names and corresponding property values. These values can be set in the property inspector. When the program is running we can still change these values by using the set command. …and view the values by using the get command

MATLAB and SimulinkLecture 611 Graphical User Interface (GUI)

MATLAB and SimulinkLecture 612 Graphical User Interface (GUI) Pushbutton Create a GUI with one pushbutton and a text field. The program shall count the number of times the user clicks on the button. Display the number of clicks in the text field.

MATLAB and SimulinkLecture 613 Graphical User Interface (GUI) In the GUIDE we start by creating a pushbutton. In the property inspector: String:ClickButton Tag:ClickButton We must also create a text field. In the property inspector: String:Number of clicks = 0 Tag:Clicks We save the GUI as Pbutton.fig This is our figure that we have created in the GUIDE. MATLAB will automatically create an m-file: Pbutton.m This file contains skeleton callback functions to the graphical objects.

MATLAB and SimulinkLecture 614 Graphical User Interface (GUI) The callback function will have the same name as the tag. function tag_Callback(hObject, eventdata, handles) All callback functions have handles to all graphical object as an input argument. handles is a structure with all graphical handles. We can access all objects from a callback function

MATLAB and SimulinkLecture 615 Graphical User Interface (GUI) Toggle buttons Every time a user clicks on it a callback is generated. Two states On = 1 Off = 0 Val=get(handles.togglebutton,’Value’) Radio buttons/Check boxes Every time a user clicks on it a callback is generated. Two states On = 1 Off = 0 Val=get(handles. radiobutton,’Value’)

MATLAB and SimulinkLecture 616 Graphical User Interface (GUI) Text fields Graphical object that displays a text string Text fields do not create callbacks. Can be changed in other callback functions by using: Set(handles.text,’String’,str) Edit boxes Allows a user to enter a text string Generates a callback when the user presses the Enter Key sentence=get(handles.edit,'String');

MATLAB and SimulinkLecture 617 Graphical User Interface (GUI) Example: Let a user write a sentence in an edit box. Rewrite the sentence backwards in a text field

MATLAB and SimulinkLecture 618 Graphical User Interface (GUI) Frames Used for drawing boxes around logically related objects Frames do not generate callbacks

MATLAB and SimulinkLecture 619 Graphical User Interface (GUI) Popup Menus Allows a user to select one of a mutually exclusive list of options The list of options is specified by a cell array of strings Example: Create a popup menu with three options. Display the users choice in a text field

MATLAB and SimulinkLecture 620 Graphical User Interface (GUI) List boxes Functionality as popup menus The difference between them is that a user can choose more then one line. To enable multiple line choices set the max-min difference greater then 1 in the property editor.

MATLAB and SimulinkLecture 621 Graphical User Interface (GUI) Sliders Allows users to select values from a continues range. Generate callbacks Example: Construct a GUI with a slider. Display actual value in a text field.

MATLAB and SimulinkLecture 622 Graphical User Interface (GUI) Dialog boxes A special type of figure Used to display information or to get information from the user. Errordlg Helpdlg Inputdlg Etc

MATLAB and SimulinkLecture 623 Graphical User Interface (GUI) Menus Use the menu editor in GUIDE Menus generate callbacks

MATLAB and SimulinkLecture 624 Exercises on this days topics Create a GUI that plots the water level in the water tanks. We will use the differential equation from the tank process. Create a GUI with: A start button. Axes that are plotting the levels Check boxes so that the user could chose which tank he/she wants to see. Add more features if you like.

MATLAB and SimulinkLecture 625 Exercises on this days topics function xprim=TankODE(t,x) A=2734e-6; a=7e-6; km=2.7e-6; g=9.82; alfa=a/A; beta=km/A; xprim = [(beta*5-alfa*sqrt(x(1)*2*g)) alfa*sqrt(x(1)*2*g)-alfa*sqrt(x(2)*2*g)]; Return To solve the equation 500],[0 0]);