Matlab Gui Cee3804

Embed Size (px)

Citation preview

  • 8/14/2019 Matlab Gui Cee3804

    1/13

    Virginia Polytechnic Institute and State University

    1 of 13

    Introduction to MATLAB

    MATLAB Graphic User Interfaces (GUI)

    Computer Applications in Civil Engineering

    Drs. Trani and Rakha

    Civil and Environmental Engineering

    Virginia Polytechnic Institute and State University

    Spring 2000

  • 8/14/2019 Matlab Gui Cee3804

    2/13

    Virginia Polytechnic Institute and State University

    2 of 13

    Purpose of this Section

    To illustrate some examples of the potential GUIcapabilities of MATLAB

    To illustrate some of the basic principles in creating

    useful GUIs

    Suggested reading: Chapter 6 in Pratab

  • 8/14/2019 Matlab Gui Cee3804

    3/13

    Virginia Polytechnic Institute and State University

    3 of 13

    Creating Graphic User Interfaces in MATLAB

    MATLAB has modest resources to create a Graphic UserInterface (GUI)

    A GUI might be useful for applications where navigationcomplexity is an issue

    A GUI might be useful to present students withinformation about a model

    The GUI tool included in MATLAB is similar to thosefound in many high-level languages (drag-dropapproach). The idea is to create a simple interface

    dragging some pre-built objects to an empty figure

    To start the GUI tool type >>guide at the Commandprompt

  • 8/14/2019 Matlab Gui Cee3804

    4/13

    Virginia Polytechnic Institute and State University

    4 of 13

    Mechanics of a Typical GUI

    % Define Initial Conditions of the Problem

    yN = [200 200 0];% yN defines intial conditions for...state variables

    to = 0.0;% to is the initial time to solve this...

    equation (yr)

    tf = 10.0;% tf is the final time (yr)

    tspan = [to tf]

    Callback function

    MATLAB GUI

    MATLAB Code

  • 8/14/2019 Matlab Gui Cee3804

    5/13

    Virginia Polytechnic Institute and State University

    5 of 13

    Sample GUI Created In MATLAB

  • 8/14/2019 Matlab Gui Cee3804

    6/13

    Virginia Polytechnic Institute and State University

    6 of 13

    GUI Guide Interface

    The MATLAB GUI guide is where you start the process

    of building an interface

  • 8/14/2019 Matlab Gui Cee3804

    7/13

    Virginia Polytechnic Institute and State University

    7 of 13

    GUI Figure Start-up

    Once guide is invoked an empty figure is generated

    Note the grid guides to allow positioning control of

    objects

  • 8/14/2019 Matlab Gui Cee3804

    8/13

    Virginia Polytechnic Institute and State University

    8 of 13

    Alignment Control Window

    The alignment control window allows precise control of

    graphical object

  • 8/14/2019 Matlab Gui Cee3804

    9/13

    Virginia Polytechnic Institute and State University

    9 of 13

    Callback Window Editor

    In the callback window editor you enter script actions that

    connect your GUI with pieces of the MATLAB code

  • 8/14/2019 Matlab Gui Cee3804

    10/13

    Virginia Polytechnic Institute and State University

    10 of 13

    Menu Editor

    The menu editor allows you to add and create pull-down

    menu items in your interface

  • 8/14/2019 Matlab Gui Cee3804

    11/13

    Virginia Polytechnic Institute and State University

    11 of 13

    Further Reading in MATLAB

    There are numerous textbooks on MATLAB. Here is apartial list of textbooks that might be useful in futurestudies:

    1) Getting Started with MATLAB 5: A Quick Introduction

    for Scientists and Engineers

    . Rudra Pratab. Oxford

    University Press, 1998 (ISBN 0-19-512947-4).

    2)MATLAB for Engineering Applications

    . William J.

    Palm. WCB Mc-Graw Hill, 1998 (ISBN 0-07-047330-

    7).

    3)MATLAB 5 for Engineers . Adrian Biran & Moshe

    M.G. Breiner. Addison-Wesley, 1999 (ISBN 0-201-

    36043-8)

  • 8/14/2019 Matlab Gui Cee3804

    12/13

    Virginia Polytechnic Institute and State University

    12 of 13

    General Books About MATLAB

    4)Engineering Problem Solving with MATLAB, 2e

    .

    Delores M. Etter. Prentice Hall, 1997 (ISBN 0-13-

    397688-2)

    5)Essential MATLAB for Scientists and Engineers

    . Brian

    D. Hahn. Arnold Publishing Co., 1997, (ISBN 0-470-

    25013-5)

    6)Introduction to MATLAB for Engineers

    . William J.

    Palm III. McGraw-Hill, 1998 (ISBN 0-07-047328-5)

    7) Mastering MATLAB 5: A Comprehensive Tutorial andReference

    . Duane C. Hanselman & Bruce Littlefield.

    Prentice Hall, 1998 (ISBN 0-13-858366-8)

  • 8/14/2019 Matlab Gui Cee3804

    13/13

    Virginia Polytechnic Institute and State University

    13 of 13

    General Books About MATLAB

    8) Graphics and GUIs with MATLAB: 2e

    . Patrick

    Marchand. CRC Press, Inc., 1999 (ISBN 0-8493-

    9487-2)