MATLAB Creating Graphical User Interfaces

(Barry) #1

About UIs in MATLAB Software



  • About UIs in MATLAB Software

    • What Is a UI? 1-

    • How Does a UI Work?. 1-

    • Ways to Build MATLAB UIs 1-



  • How to Create a UI with GUIDE

    • Create a Simple UI Using GUIDE. 2-

      • Open a New UI in the GUIDE Layout Editor 2-

      • Set the Window Size in GUIDE 2-

      • Layout the Simple GUIDE UI. 2-

      • Code the Behavior of the Simple GUIDE UI 2-

      • Open and Run the Simple GUIDE UI 2-



    • Files Generated by GUIDE 2-

      • Code Files and FIG-Files. 2-

      • UI Code File Structure. 2-

      • Adding Callback Templates to an Existing UI Code File 2-

      • About GUIDE-Generated Callbacks 2-





  • A Simple Programmatic UI

    • Create a Simple UI Programmatically 3-

      • Create a Code File for the Simple Programmatic UI 3-

      • Create a Figure for the Simple Programmatic UI. 3-

      • Add Components to the Simple Programmatic UI. 3-

      • Code the Simple Programmatic UI Behavior. 3-

      • Verify Code and Run the Program 3-





  • What Is GUIDE?

    • GUIDE: Getting Started 4-

      • UI Layout. 4-

      • UI Programming. 4-



    • GUIDE Tools Summary. 4-



  • GUIDE Preferences and Options

    • GUIDE Preferences. 5-

      • Set Preferences. 5-

      • Confirmation Preferences 5-

      • Backward Compatibility Preference 5-

      • All Other Preferences. 5-



    • GUIDE Options. 5-

      • The GUI Options Dialog Box. 5-

      • Resize Behavior 5-

      • Command-Line Accessibility. 5-

      • Generate FIG-File and MATLAB File 5- vii

      • Generate FIG-File Only. 5-





  • Lay Out a UI Using GUIDE

    • GUIDE Templates. 6-

      • Access the Templates 6-

      • Template Descriptions 6-



    • Set the UI Window Size in GUIDE. 6-

      • Window. 6- Prevent Existing Objects from Resizing with the

      • Set the Window Position or Size to an Exact Value 6-

      • Maximize the Layout Area. 6-



    • GUIDE Components. 6-

    • Add Components to the GUIDE Layout Area 6-

      • Place Components. 6-

      • User Interface Controls. 6-

      • Panels and Button Groups. 6-

      • Axes 6-

      • Table. 6-

      • ActiveX Component. 6-

      • Resize GUIDE UI Components. 6-



    • Copy, Paste, and Arrange Components 6-

      • Select Components. 6-

      • Copy, Cut, and Clear Components. 6-

      • Paste and Duplicate Components. 6-

      • Front-to-Back Positioning 6-



    • Locate and Move Components. 6-

      • Use Coordinate Readouts. 6-

      • Drag Components 6-

      • Use Arrow Keys to Move Components. 6-

      • Set the Component's Position Property. 6-



    • Align GUIDE UI Components 6- viii Contents

      • Align Objects Tool. 6-

      • Property Inspector. 6-

      • Grid and Rulers. 6-

      • Guide Lines 6-



    • Customize Tabbing Behavior in a GUIDE UI 6-

    • Create Menus for GUIDE UIs 6-

      • Menus for the Menu Bar 6-

      • Context Menus. 6-



    • Create Toolbars for GUIDE UIs 6-

      • Toolbar and Tools. 6-

      • Editing Tool Icons. 6-



    • View the GUIDE Object Hierarchy 6-

    • Design Cross-Platform UIs in GUIDE. 6-

      • Default System Font. 6-

      • Standard Background Color. 6-

      • Cross-Platform Compatible Units. 6-



    • UI Design References. 6-



  • Save and Run a GUIDE UI

    • Save a GUIDE UI 7-

      • Save a UI. 7-

      • Create a Backward Compatible GUIDE Fig-File. 7-

        • File. 7- Append New Callbacks to an Existing GUIDE Code





    • Create Programmatic Files from GUIDE Files. 7-

    • Rename GUIDE UIs and Files. 7-



  • Programming a GUIDE UI

    • Write Callbacks Using the GUIDE Workflow 8-

      • Callbacks for Different User Actions. 8-

        • Values. 8- GUIDE-Generated Callback Functions and Property



      • GUIDE Callback Syntax 8-

      • Renaming and Removing GUIDE-Generated Callbacks 8-



    • Initialize UIs Created Using GUIDE 8-

      • Opening Function 8-

      • Output Function. 8-



    • Callbacks for Specific Components. 8-

      • How to Use the Example Code. 8-

      • Push Button. 8-

      • Toggle Button. 8-

      • Radio Button. 8-

      • Check Box 8-

      • Edit Text Field 8-

      • Slider. 8-

      • List Box. 8-

      • Pop-Up Menu. 8-

      • Panel 8-

      • Button Group. 8-

      • Menu Item 8-

      • Table. 8-

      • Axes 8-



    • Examples of GUIDE UIs 8-



  • Examples of GUIDE UIs

    • Modal Dialog Box in GUIDE. 9-

      • About the Example 9-

      • Set Up the Close Confirmation Dialog Box 9-

      • Set Up a UI with a Close Button 9-



    • Run the Program 9- x Contents

    • How Close Confirmation Dialogs Work. 9-



  • UI That Uses Persistent Data. 9-

    • About the Example 9-

    • Calling Syntax. 9-

    • MAT-file Validation 9-

    • UI Behavior. 9-

    • Overall UI Characteristics 9-



  • UI That Accepts Parameters and Generates Plots 9-

    • About the Example 9-

    • UI Design 9-

    • Validate Input as Numbers. 9-

    • Plot Push Button Behavior. 9-



  • Synchronized Data Presentations in a GUIDE UI 9-

    • About the Example 9-

    • Recreate the UI 9-



  • Interactive List Box in a GUIDE UI. 9-

    • About the Example 9-

    • Implement the List Box 9-



  • Plot Workspace Variables in a GUIDE UI. 9-

    • About the Example 9-

    • Read Workspace Variables 9-

    • Read Selections from List Box 9-



  • UI for Setting Simulink Model Parameters 9-

    • About the Example 9-

    • How to Use the UI. 9-

    • Run the Program 9-

    • Program the Slider and Edit Text Components. 9-

    • Run the Simulation from the UI 9-

    • Remove Results from List Box 9-

    • Plot Results Data. 9-

    • The Help Button. 9-

    • Close the UI. 9-

    • The List Box Callback and Create Function. 9-



  • Animation with Slider Controls in GUIDE 9-

    • About the Example 9-

      • Design the 3-D Globe UI. 9- xi

      • Graphics Techniques Used in the 3-D Globe UI. 9-



    • Automatically Refresh Plot in a GUIDE UI. 9-

      • About the Example 9-

      • The Timer Implementation 9-





  • Lay Out a Programmatic UI

    • Structure of Programmatic UI Code Files. 10-

      • File Organization. 10-

      • File Template. 10-

      • Run the Program 10-



    • Create Figures for Programmatic UIs. 10-

    • Programmatic Components. 10-

    • Add Components to a Programmatic UI. 10-

      • User Interface Controls. 10-

      • Tables. 10-

      • Panels. 10-

      • Button Groups. 10-

      • Axes 10-

      • ActiveX Controls 10-

      • How to Set Font Characteristics. 10-



    • Lay Out a UI Programmatically. 10-

      • Component Placement and Sizing. 10-

      • Managing the Layout in Resizable UIs 10-

      • Manage the Stacking Order of Grouped Components. 10-



    • Adjust Programmatic UI Layouts Interactively 10-

      • Set Positions of Components Interactively. 10-

      • Align Components 10-

      • Set Colors Interactively 10- xii Contents

      • Set Font Characteristics Interactively 10-



    • Customize Tabbing Behavior in a Programmatic UI. 10-

      • How Tabbing Works 10-

      • Default Tab Order 10-

      • Change the Tab Order in the uipanel. 10-



    • Create Menus for Programmatic UIs 10-

      • Add Menu Bar Menus. 10-

      • Add Context Menus to a Programmatic UI. 10-



    • Create Toolbars for Programmatic UIs. 10-

      • Use the uitoolbar Function. 10-

      • Commonly Used Properties. 10-

      • Toolbars. 10-

      • Display and Modify the Standard Toolbar. 10-



    • Fonts and Colors for Cross-Platform Compatibility 10-

      • Default System Font. 10-

      • Standard Background Color. 10-





  • Code a Programmatic UI

    • Initialize a Programmatic UI. 11-

      • Examples. 11-



    • Write Callbacks Using the Programmatic Workflow 11-

      • Callbacks for Different User Actions. 11-

      • How to Specify Callback Property Values. 11-

      • Callback Syntax. 11-





  • Manage Application-Defined Data

    • Share Data Among Callbacks. 12-

      • Overview of Data Sharing Techniques. 12-

      • Store Data in UserData or Other Object Properties 12-

      • Store Data as Application Data. 12-

        • UIs) 12- Create Nested Callback Functions (Programmatic



      • Store Data Using the guidata Function. 12-

      • Sharing Data Among Multiple GUIDE UIs 12-





  • Manage Callback Execution

    • Interrupt Callback Execution. 13-

      • How to Control Interruption 13-

      • Callback Behavior When Interruption is Allowed. 13-

      • Example. 13-





  • Examples of UIs Created Programmatically

    • Axes, Menus, and Toolbars in Programmatic UIs 14-

      • About the Example 14-

      • View the Example Code. 14-

      • Generate the Graphing Commands and Data. 14-

      • Create the UI and Its Components. 14-

      • Initialize the UI. 14-

      • Define the Callbacks. 14-

      • Updating the Plot. 14-

      • UI. 14- Synchronized Data Presentations in a Programmatic

        • Techniques Illustrated in the Example 14-

        • About the Example. 14-

        • View the Example Code. 14- xiv Contents

        • Set Up and Interact with the uitable. 14-



      • Lists of Items in a Programmatic UI. 14-

        • About the Example. 14-

        • View the Example Code. 14-

        • Use the UI. 14-

        • Program List Master. 14-

        • Add an “Import from File” Option to List Master 14-

        • Add a “Rename List” Option to List Master 14-



      • UI for a Program That Accepts Arguments. 14-

        • About the Example. 14-

        • Copy and View the Color Palette Code. 14-

        • Local Function Summary for Color Palette. 14-

        • Code File Organization. 14-

        • UI Programming Techniques. 14-







  • Apps

    • Find Apps 15-

    • View App File List. 15-

      • Before Installing. 15-

      • After Installing. 15-



    • Run, Uninstall, Reinstall, and Install Apps. 15-

      • Run App. 15-

      • Install or Reinstall App 15-

      • Uninstall App 15-



    • Install Apps in a Shared Network Location 15-

    • Change Apps Installation Folder. 15-



  • Packaging GUIs as Apps

    • Apps Overview. 16-

      • What Is an App? 16-

      • Where to Get Apps. 16-

      • Why Create an App? 16-

      • Best Practices and Requirements for Creating an App. 16-



    • Package Apps. 16-

    • Modify Apps 16-

    • Share Apps. 16-

    • MATLAB App Installer File — mlappinstall. 16-

    • Dependency Analysis. 16-





  • • “What Is a UI?” on page 1-

  • • “How Does a UI Work?” on page 1-

  • • “Ways to Build MATLAB UIs” on page 1-

Free download pdf