GUI with Matlab - Outline



Similar documents
MATLAB. Input and Output

MATLAB 7 Creating Graphical User Interfaces

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

MATLAB Workshop 14 - Plotting Data in MATLAB

Tutorial: Biped Character in 3D Studio Max 7, Easy Animation

PLOTTING IN SCILAB.

Plotting: Customizing the Graph

Create a Poster Using Publisher

Fireworks CS4 Tutorial Part 1: Intro

Tutorial for Tracker and Supporting Software By David Chandler

Maya 2014 Basic Animation & The Graph Editor

Pro/ENGINEER Wildfire 4.0 Basic Design

Simple Programming in MATLAB. Plotting a graph using MATLAB involves three steps:

Investigating Parametric Curves with MATLAB

DWGSee Professional User Guide

Sharing Files and Whiteboards

ART 269 3D Animation Fundamental Animation Principles and Procedures in Cinema 4D

Graphic Design. Background: The part of an artwork that appears to be farthest from the viewer, or in the distance of the scene.

Creating Web Pages with Microsoft FrontPage

Formulas, Functions and Charts

GelAnalyzer 2010 User s manual. Contents

Microsoft Excel 2010 Charts and Graphs

BD CellQuest Pro Software Analysis Tutorial

Smart Board Notebook Software A guide for new Smart Board users

Publisher 2010 Cheat Sheet

Dealing with Data in Excel 2010

Instructions for Creating a Poster for Arts and Humanities Research Day Using PowerPoint

Anime Studio Debut vs. Pro

Visualization of 2D Domains

The main imovie window is divided into six major parts.

MATLAB GUIs. We conclude our brief overview of MATLAB by looking at : Brief introduction to MATLAB GUI building. Back Close CM0268 MATLAB DSP GRAPHICS

MatLab Basics. Now, press return to see what Matlab has stored as your variable x. You should see:

PowerPoint 2007 Basics Website:

Excel -- Creating Charts

FreeCapture - A PC remote control program for GDS-800

Table Of Contents. Table Of Contents

Sharing Presentations, Documents, and Whiteboards

NIS-Elements Viewer. User's Guide

Introduction to Microsoft Excel 2007/2010

Scatter Plots with Error Bars

Excel Tutorial. Bio 150B Excel Tutorial 1

Using Your Polyvision Digital Whiteboard and Walk-and-Talk

PowerPoint 2007: Basics Learning Guide

Using MATLAB to develop standalone graphical user interface (GUI)

Introduction to Graphical User Interface (GUI) MATLAB 6.5

Adobe Acrobat Professional DC Tutorial

This activity will show you how to draw graphs of algebraic functions in Excel.

Introduction to Matlab: Application to Electrical Engineering

VisIt Visualization Tool

SketchUp Instructions

LAYOUT OF THE KEYBOARD

Epson Brightlink Interactive Board and Pen Training. Step One: Install the Brightlink Easy Interactive Driver

SAS/GRAPH 9.2 ODS Graphics Editor. User s Guide

CATIA Functional Tolerancing & Annotation TABLE OF CONTENTS

Recipes4Success. Animate a Rocket Ship. Frames 6 - Drawing Tools

WebEx Sharing Resources

WAYNESBORO AREA SCHOOL DISTRICT CURRICULUM INTRODUCTION TO GRAPHICS

Overview of the Adobe Flash Professional CS6 workspace

The following is an overview of lessons included in the tutorial.

Graphic Design Studio Guide

Adobe Illustrator CS5 Part 1: Introduction to Illustrator

imc FAMOS 6.3 visualization signal analysis data processing test reporting Comprehensive data analysis and documentation imc productive testing

Introduction to Visualization with VTK and ParaView

SMART Notebook 10 Software for Mac Computers. Creating SMART Notebook Files

Introduction to CATIA V5

Experiment 2 Introduction to TI C2000 Microcontroller, Code Composer Studio (CCS) and Matlab Graphic User Interface (GUI)

Welcome to CorelDRAW, a comprehensive vector-based drawing and graphic-design program for the graphics professional.

Linkage 3.2. User s Guide

Microsoft Office 2010: Introductory Q&As PowerPoint Chapter 3

SMART Board Menu. Full Reference Guide

Adobe Certified Expert Program

CONSTRUCTING SINGLE-SUBJECT REVERSAL DESIGN GRAPHS USING MICROSOFT WORD : A COMPREHENSIVE TUTORIAL

Absorbance Spectrophotometry: Analysis of FD&C Red Food Dye #40 Calibration Curve Procedure

MovieClip, Button, Graphic, Motion Tween, Classic Motion Tween, Shape Tween, Motion Guide, Masking, Bone Tool, 3D Tool

MicroStrategy Analytics Express User Guide

PLOTTING COMMANDS (!' ) "' # "*# "!(!' +,

COOL ART WITH MATH & SCIENCE OPTICAL ILLUSIONS CREATIVE ACTIVITIES THAT MAKE MATH & SCIENCE FUN FOR KIDS! A NDERS HANSON AND ELISSA MANN

Visualization with ParaView

Parametric Technology Corporation. Pro/ENGINEER Wildfire 4.0 Design Animation Concepts Guide

Fireworks 3 Animation and Rollovers

RELEASE NOTES OF NEW FEATURES AND ENHANCEMENTS FOR TRIALDIRECTOR VERSION PRESENTATION. Additional Layouts for Displaying Synchronized Video

imc FAMOS 6.3 visualization signal analysis data processing test reporting Comprehensive data analysis and documentation imc productive testing

GeoGebra Statistics and Probability

Feature Comparison of PTC Creo View MCAD. Product Suite. Topic Sheet. Page 1 of 6 Feature Comparison of PTC Creo View MCAD Product Suite

Introduction to the TI Connect 4.0 software...1. Using TI DeviceExplorer...7. Compatibility with graphing calculators...9

Cabri Geometry Application User Guide

Lesson 4. Temporal Management of Layers

Revision history: New comments added to: m)! Universal Driver

Joomla Article Advanced Topics: Table Layouts

Lession: 2 Animation Tool: Synfig Card or Page based Icon and Event based Time based Pencil: Synfig Studio: Getting Started: Toolbox Canvas Panels

The Dashboard. Change ActivInspire's Look And Feel. ActivInspire Primary. ActivInspire Studio. <- Primary. Studio -> page 1

Chapter 4 Windows Applications Notepad, WordPad, and Paint

EDIT202 PowerPoint Lab Assignment Guidelines

Microsoft Office 2010: Introductory Q&As PowerPoint Chapter 1

Flash MX 2004 Animation Lesson

MATLAB Data Analysis. R2015b

Creating Charts in Microsoft Excel A supplement to Chapter 5 of Quantitative Approaches in Business Studies

Transcription:

Technion Electrical Engineering Department May 2004 Signal and Image Processing Laboratory Written By: Yair Moshe 1 GUI with Matlab - Outline 1. Basic Graphics 2. Animation 3. Handle Graphics Objects 4. Creating GUI using GUIDE 2 1

1. Basic Graphics 2-D Plotting The Figure Window Data Statistics & Curve Fitting Subplots & Scales for Axes Specialized Plotting Routines 3-D Plotting Images 3 2-D Plotting x=0:.1:2*pi; y=sin(x); plot(x,y) grid on hold on plot(x, exp(-x), 'r:*') axis([0 2*pi 0 1]) title('2-d Plot') xlabel('time') ylabel('sin(t) ') text(pi/3, sin(pi/3), '<--sin(\pi/3) ') legend('sine Wave', 'Decaying Exponential') 4 2

Line Characteristics Specifier Line Color Specifier Marker Style b blue. point g green o circle r red x x-mark c cyan + plus m magenta * star y yellow s square k black d diamond v triangle down Specifier Line Style ^ triangle up - solid < triangle left : dotted > triangle right -. dashdot p pentagram -- dashed h hexagram 5 The Figure Window The figure window contains useful actions in its menu and toolbars: Zooming in and out Rotating 3-D axes (and other camera actions) Copying & pasting Plot Edit Mode Property Editor Saving & Exporting Figures can be saved in a binary.fig file format Figure can be exported to many standard graphics file formats etc., GIF, PNG, JPEG, TIFF, BMP, PCX, EPS. Printing 6 3

Data Statistics & Curve Fitting The Data Statistics Tool: Calculates basic statistics about the central tendency and variability of data plotted in a graph Plots any of the statistics in a graph The Basic Fitting Interface: Fits data using a spline interpolant, a shape-preserving interpolant, or a polynomial up to degree 10 Plots multiple fits simultaneously for a given data set Examines the numerical results of a fit Annotates the plot with the numerical fit results and the norm of residuals 7 Subplots & Scales for Axes subplot(2,2,1) x=0:.1:2*pi; plot(x, exp(-x)) subplot(2,2,2) semilogy(x, exp(-x)) subplot(2,2,3) x=0:.1:2*pi; plot(x, sin(x)) subplot(2,2,4) plot(peaks) 8 4

Specialized Plotting Routines 9 3-D Plotting z = 0:0.1:10*pi; x = exp(-z/20).*cos(z); y = exp(-z/20).*sin(z); plot3(x,y,z,'linewidth',2) grid on xlabel('x') ylabel('y') zlabel('z') 10 5

3-D Meshes and Surfaces 11 3-D Meshes and Surfaces 12 6

Images [x,map]=imread('flowers.tif'); image(x) colormap(map) 13 Images a = magic(4); image(a); map = hsv(16); colormap(map) colorbar 14 7

2. Animation On the Fly Animation Frame by Frame Animation 15 Animation Matlab provides two ways of generating moving, animated graphics: 1. On the fly - Continually erase and then redraw the objects on the screen, making incremental changes with each redraw. 2. Frame by frame capture and playback - Save a number of different pictures and then play them back as a movie. 16 8

On the Fly Animation Example for on the fly animation: t = 0:0.01:10*pi; x = t.*sin(t); y = t.*cos(t); axislimits = [min(x) max(x) min(y) max(y) min(t) max(t)]; line_handle = plot3(x(1), y(1),t(1), 'ko',... 'MarkerFaceColor',[.49 1.63], 'MarkerSize',12); set(line_handle, 'erasemode','xor'); axis(axislimits); grid on for i = 2:length(x) set(line_handle, 'xdata',x(i), 'ydata', y(i), 'zdata', t(i)); drawnow; end 17 Frame by Frame animation Example for frame by frame movie creation and playing: [x,y] = meshgrid([-10:0.5:10]); for j = 1:15 z = bessel(0, (j-1)*0.2 + sqrt(x.^2 +y.^2)); surf(x,y,z) axis([-10 10-10 10 -.5 1]) M(j) = getframe; end frame_order = [1:15 14:-1:1]; number_repeats = 5; movie(m, [number_repeats frame_order]); 18 9

3. Handle Graphics Handle Graphics Objects Graphics Objects Hierarchy Obtaining an Object s Handle Modifying Object Properties 19 Handle Graphics Objects Handle Graphics is an object-oriented structure for creating, manipulating and displaying graphics Graphics in Matlab consist of objects Every graphics objects has: a unique identifier, called handle a set of properties which define its appearance 20 10

Graphics Objects Hierarchy Objects are organized into a tree-structure hierarchy: 21 Graphics Objects Hierarchy UIMenu Objects Figure Object Surface Object UIControl Objects Patch Object Text Objects 22 11

Obtaining an Object s Handle Upon creation, for example: h = plot(x_data, y_data, ) Using utility functions: 0 - root object handle (the screen) gcf returns the handle for current figure gca - returns the handle for current axes gco - returns the handle for current object gcbf - returns the handle for callback figure gcbo - returns the handle for callback object 23 Modifying Object Properties Return a list of all object properties and their current values: get(handle) Return a list of all user-settable object properties and their current values: set(handle) Return current value of an object property: get(handle, PropertyName ) Example: get(gcf, 'Color') Return a list of all possible values for an object property: Set(handle, PropertyName ) Example: set(gca, 'XDir') Set an object property to a new value: set(handle, PropertyName, NewValue ) Example: set(gca, 'XDir', 'Reverse') All the above can also be done (but not at runtime) using the Property Editor 24 12

Example Figure Position space = 5; top_space = 80; scn_size = get(0,'screensize'); pos1 = [space, 2/3*scn_size(4) + space,... scn_size(3)/2-2*space, scn_size(4)/3 - (top_space + space)]; pos2 = [pos1(1) + scn_size(3)/2, pos1(2),... pos1(3), pos1(4)]; h1 = figure(1); peaks; h2 = figure(2); membrane; set(h1, 'Position', pos1) set(h2, 'Position', pos2) 25 4. Creating GUI using GUIDE What is GUIDE? Creating a GUI The Layout Editor Hands-On GUIDE Example Writing Callbacks 26 13

What is GUIDE? GUIDE is Matlab s Graphics User Interface (GUI) Design Environment GUIDE stores GUIs in two files, which are generated the first time you save or run the GUI:.fig file - contains a complete description of the GUI figure layout and the components of the GUI Changes to this file are made in the Layout Editor.m file - contains the code that controls the GUI You can program the callbacks in this file using the M-file Editor 27 Creating a GUI Typical stages of creating a GUI are: 1. Designing the GUI 2. Laying out the GUI Using the Layout Editor 3. Programming the GUI Writing callbacks in the M-file Editor 4. Saving and Running the GUI 28 14

The Layout Editor The Layout Editor looks like this: Alignment Tool Menu Editor M-File Editor Component Palette Run Button Object Browser Property Inspector Layout Area Figure Resize Tab 29 Hands-On GUIDE Example Example: 30 15

Writing Callbacks A callback is a sequence of commands that are execute when a graphics object is activated Stored in the GUI s M-file Is a property of a graphics object (e.g. CreateFnc, ButtonDwnFnc, Callback, DeleteFnc) Also called event handler in some programming languages A callback is usually made of the following stages: 1. Getting the handle of the object initiating the action (the object provides event / information / values) 2. Getting the handles of the objects being affected (the object that whose properties are to be changed) 3. Getting necessary information / values 4. Doing some calculations and processing 5. Setting relevant object properties to effect action 31 Writing Callbacks Callback from example: % --- Executes on button press in plot_button. function plot_button_callback(hobject, eventdata, handles) % hobject handle to plot_button (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get user input from GUI f1 = str2double(get(handles.f1_input,'string')); f2 = str2double(get(handles.f2_input,'string')); t = eval(get(handles.t_input,'string')); % Calculate data % Create frequency plot axes(handles.frequency_axes) % Select the proper axes plot(f,m(1:257)) xlabel('frequency'); set(handles.frequency_axes,'xminortick','on') grid on 32 16

Further Information 1. The Mathworks, Using Matlab Graphics 2. The Mathworks, Creating Graphics User Interfaces 3. Marchand Patrick, Holland Thomas O., Graphics and GUIs with Matlab, 3 ed, 2003, CRC Press The documents from Mathworks could be found on: http://www.mathworks.com/access/helpdesk/help/techdoc/matlab.shtml Most of this info can also be found in Matlab s help 33 34 17