Interactive Programs

Similar documents
BUILDING A MATLAB GUI. Education Transfer Plan Seyyed Khandani, Ph.D. IISME 2014

Blind to Change. More on Graphical User Interfaces. Exploring change blindness

Still More About Matlab GUI s (v. 1.3) Popup Menus. Popup Menu Exercise. Still More GUI Info - GE /29/2012. Copyright C. S. Tritt, Ph.D.

Homeworks on FFT Instr. and Meas. for Communication Systems- Gianfranco Miele. Name Surname

Special Topics II: Graphical User Interfaces (GUIs)

There are two ways to launch Graphical User Interface (GUI). You can either

MATLAB. Creating Graphical User Interfaces Version 7. The Language of Technical Computing

SBT 645 Introduction to Scientific Computing in Sports Science #5

% Edit the above text to modify the response to help Video_Player. % Last Modified by GUIDE v May :38:12

GUI Building for Test & Measurement Applications

INTRODUCTION TO MATLAB INTERACTIVE GRAPHICS EXERCISES

Completing this project will help you learn about one-dimensional arrays and how to implement and use functions. More on Matlab graphics GUI design.

The Language of Technical Computing. Computation. Visualization. Programming. Creating Graphical User Interfaces Version 1

Graphical User Interface. GUI in MATLAB. Eng. Banan Ahmad Allaqta

Flash Tutorial. Working With Text, Tween, Layers, Frames & Key Frames

SciGraphica. Tutorial Manual - Tutorials 1and 2 Version 0.8.0

How to lay out a web page with CSS

Signal and Systems. Matlab GUI based analysis. XpertSolver.com

Ambra User Guide. If you need help. Ambra Support (any time)

How to lay out a web page with CSS

Building a Graphical User Interface

Introduction To MATLAB Interactive Graphics

Dreamweaver CS3 Concepts and Techniques

LISTING PROGRAM. % Edit the above text to modify the response to help cover. % Last Modified by GUIDE v Jun :24:43

LEARNING TO PROGRAM WITH MATLAB. Building GUI Tools. Wiley. University of Notre Dame. Craig S. Lent Department of Electrical Engineering

LAMPIRAN 1. Percobaan

% Edit the above text to modify the response to help Principal

We are IntechOpen, the world s leading publisher of Open Access books Built by scientists, for scientists. International authors and editors

Using IPACS Webserver:

Adobe Flash CS4 Part 3: Animation

The figure below shows the Dreamweaver Interface.

Figure 1 Forms category in the Insert panel. You set up a form by inserting it and configuring options through the Properties panel.

Keynote 08 Basics Website:

1. Peralatan LAMPIRAN

DUNREEB CUTOUT INSTRUCTIONS FOR THE PROGRAM

Plotting using Matlab. Vytautas Astromskas

MATLAB Second Seminar

Advanced Dreamweaver CS6

Pick a number. Conditionals. Boolean Logic Relational Expressions Logical Operators Numerical Representation Binary. CS Conditionals 1

How to start your Texture Box Project!

Graphing. ReportMill Graphing User Guide. This document describes ReportMill's graph component. Graphs are the best way to present data visually.

Matlab Programming MET 164 1/24

Goldfish 4. Quick Start Tutorial

Table of Contents. Introduction.*.. 7. Part /: Getting Started With MATLAB 5. Chapter 1: Introducing MATLAB and Its Many Uses 7

Table of contents. Universal Data Exporter ASP DMXzone.com

Eurostat Regions and Cities Illustrated: Usage guide

Numbers Basics Website:

Animating Layers with Timelines

Ordering Railing by Section

Flow Sim. Chapter 12. F1 Car. A. Enable Flow Simulation. Step 1. If necessary, open your ASSEMBLY file.

Dear Candidate, Thank you, Adobe Education

Computational Methods of Scientific Programming. Matlab Lecture 3 Lecturers Thomas A Herring Chris Hill

EnSight 10 Basic Training Exercises

Adobe Flash CS4 Part 4: Interactivity

MAT 343 Laboratory 4 Plotting and computer animation in MATLAB

2.2 - Layouts. Bforartists Reference Manual - Copyright - This page is Public Domain

Table of contents. Sliding Billboard DMXzone.com

1. Multimedia authoring is the process of creating a multimedia production:

Keynote Basics Website:

Adobe Dreamweaver CS6 Digital Classroom

Math 165 Guided Activity to study ahead some concepts from sections 1.1 and 1.2 Name Section Distance and Midpoint Formula

InDesign ACA Certification Test 50 terms hollymsmith TEACHER

Corresponding Parts of Congruent Triangles are Congruent

User Defined Functions

Ear Recognition. By: Zeyangyi Wang

ROSE-HULMAN INSTITUTE OF TECHNOLOGY

COMSC-031 Web Site Development- Part 2

Curriculum/Certification Mapping in MyGraphicsLab

BASICS OF MOTIONSTUDIO

IEEE Wordpress Theme Documentation

Autodesk Moldflow Adviser AMA Reports

OMR Sheet Recognition

3D Surface Plots with Groups

GUI code for different sections is in following sections

FrontPage 2000 Tutorial -- Advanced

CS/NEUR125 Brains, Minds, and Machines. Due: Wednesday, March 8

Flash Image Enhancer Manual DMXzone.com Flash Image Enhancer Manual

Lithium-Ion Battery Data. Management

ADOBE VISUAL COMMUNICATION USING DREAMWEAVER CS5 Curriculum/Certification Mapping in MyGraphicsLab

WallSign TASKE Call Center Management Tools Version 7.0. Table of Contents TABLE OF CONTENTS TASKE WallSign Startup and Shutdown...

1. Complete these exercises to practice creating user functions in small sketches.

EL2310 Scientific Programming

Technology Assignment: Scatter Plots

Importing Models from Physical Modeling. Tools Using the FMI Standard

CS 231A Computer Vision (Winter 2014) Problem Set 3

Creating Forms. Starting the Page. another way of applying a template to a page.

Transformations Review

1.Matlab Image Encryption Code

Admin. CS 112 Introduction to Programming. Recap. Example: Nested Loop. Example: Rewrite

Goals: Course Unit: Describing Moving Objects Different Ways of Representing Functions Vector-valued Functions, or Parametric Curves

Contents. Implementing the QR factorization The algebraic eigenvalue problem. Applied Linear Algebra in Geoscience Using MATLAB

Geometer s Sketchpad Techno Polly

Review: Event Driven Programming & GUI. CSCE155N Matlab Fall 2016

Advanced Graphics: NOMAD Summer. Interactive analysis and visualization of complex datasets

ADOBE 9A Adobe Dreamweaver CS4 ACE.

Computational Methods of Scientific Programming Fall 2007

Computer Graphics and Visualization. What is computer graphics?

Intel Quark microcontroller D2000 How to communicate with MATLAB over UART

Planets Earth, Mars and Moon Shaders Asset V Documentation (Unity 5 version)

Maya tutorial. 1 Camera calibration

Transcription:

Interactive Programs Graphical User Interfaces CS112 Scientific Computation Department of Computer Science Wellesley College Properties of graphics objects All plotting and graphics functions create graphic objects Each graphics object is identified by a unique number call a handle that can be assigned to a variable: p1 = plot([0 1 2], [2 1 3]); Graphics objects have properties that control their appearance on the screen and can be viewed with the Property Inspector: inspect(p1) GUIs 2 1

Accessing properties with MATLAB code Graphics object properties can be accessed with the get function: get(object, property) For example, >> get(p1, 'LineWidth'); 0.5 GUIs 3 Graphics object properties can be set* by editing the value in the Property Inspector window specifying the property name and value when creating the graphics object: p1 = plot([0 1 2], [2 1 3], 'LineWidth', 1);... using the set function: set(object, property, value) >> set(p1, 'LineWidth', 1); * true for any graphics function, e.g. figure, fill, scatter, surf GUIs 4 2

Subfunctions An M-file can only contain one function that can be called from the Command Window or from another code file This function must be placed at the beginning of the file and its name must be the same as the file name Other subfunctions can be defined in an M-File, but can only be called by functions in the same M-File GUIs 5 Subfunctions for a ferris wheel movie function ferriswheel % displays an animation of a rotating ferris wheel for frame = 1:36 drawbase; hold on spokecoords = drawwheel(10*frame); drawcars(spokecoords); hold off end function drawbase % draw the blue base of the ferris wheel function spokecoords = drawwheel (angle) % draw the black spokes at the input angle and return % the coordinates of the endpoints of the spokes function drawcars (spokecoords) % draw a colored car at each location in spokecoords GUIs 6 3

Graphical User Interface (GUI) For our programs to date, we called a function or script from the Command Window and the program was executed with minimal input from the user GUI-based programs put the user in the driver s seat through interactions with components of a graphical display GUIs 7 MATLAB s Graphical User Interface Development Environment (GUIDE) GUIs 8 4

Saving the GUI layout When our energygui layout is saved the first time, MATLAB generates two files: energygui.fig: Layout Editor window with the developing GUI, which can be modified later by entering >> guide energygui.fig energygui.m: file that contains code to create the GUI display GUIs 9 Functions defined in energygui.m energygui: top-level function at the beginning of the file that is called from the Command Window. This function initializes the GUI program and opens the GUI window. We will not modify this function energygui_openingfcn: executed just before the GUI window is made visible. We will modify this function to set up data for the program energygui_outputfcn: returns outputs to the Command Window. We will not modify this function GUIs 10 5

Callback functions For each component, the header of a Callback function is created. These functions are invoked automatically when the user interacts with the corresponding component Invokes closebutton_callback when clicked by user GUIs 11 Inputs to GUI functions hobject is a number, the graphics handle, that uniquely identifies the GUI component and its associated properties eventdata is not used in the current version of MATLAB handles is a structure that contains information that needs to be shared between functions in this file. Initially it contains a field for each GUI component created, using Tag property as name: handles.axes1 handles.sourcemenu handles.sourcetoggle handles.titlelabel handles.titlebox handles.widthcheckbox handles.plotbutton handles.closebutton handles.figure1 Value of each field is the graphics handle for that component GUIs 12 6

Adding actions function energygui_openingfcn (hobject, eventdata, handles, varargin) % setup data to use for plotting [handles.years handles.produce handles.consume] = setupenergy; function sourcetoggle_callback (hobject, eventdata, handles) % use state of toggle button to set text label on button if (get(hobject, 'Value') == 0) set(hobject, 'String', 'produce'); else set(hobject, 'String', 'consume'); end guidata(hobject, handles); copy changes to global handles structure GUIs 13 More action function plotbutton_callback (hobject, eventdata, handles) % setup data source requested by user from state of toggle button if (get(handles.sourcetoggle, 'Value') == 0) datasource = handles.produce; else datasource = handles.consume; end % get index of selected energy source sourceindex = get(handles.sourcemenu, 'Value'); % use state of checkbox to determine line width linewidth = get(handles.widthcheckbox, 'Value') + 1; % plot the data with the requested properties plot(handles.years, datasource(sourceindex, :), 'Linewidth, linewidth); xlabel('years') ylabel('quadrillion btu') title(get(handles.titlebox, 'String')) GUIs 14 7

Time for you to leave function closebutton_callback (hobject, eventdata, handles) % close GUI figure window delete(handles.figure1); GUIs 15 8