More Matlab Graphics and GUI Graphics subplots some useful commands 3D graphics GUI GUI controls The callback property Other essential properties.

Slides:



Advertisements
Similar presentations
Prof. Muhammad Saeed Mathematical Modeling and Simulation UsingMATLAB Graphic User Interface (GUI)Basics.
Advertisements

MATLAB’s extensive, device-independent plotting capabilities are one of its most powerful features. They make it very easy to plot any data at any time.
Fall 2006AE6382 Design Computing1 Three Dimensional Plotting Learning Objectives –Understand the anatomy of a 3D plot –Basics of constructing plots in.
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.
Matlab for Visualization Ray Gasser IS&T Scientific Visualization Tutorial – Spring 2010.
Graphics in MATLAB Week 15 – 5/5/09 Kate Musgrave
Automating Tasks With Macros
1 How to create GUI's in MatLAB Rigo Dicochea. 2 Introduction Graphical User Interface (GUI) MatLab provides Graphical User Interface Development Environment(GUIDE)
Automating Tasks With Macros. 2 Design a switchboard and dialog box for a graphical user interface Database developers interact directly with Access.
MATLAB Week 3 17 November Outline Graphics – Basic plotting – Editing plots from GUI – Editing plots from m-file – Advanced plotting commands.
Introduction to MATLAB MECH 300H Spring Starting of MATLAB.
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.
 1999 BG Mobasseri1 8/29/2015 MATLAB GRAPHICS - PART II ADVANCED PLOTTING June 4, ‘99.
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.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
PLOTS AND FIGURES DAVID COOPER SUMMER Plots One of the primary uses for MATLAB is to be able to create publication quality figures from you data.
CMPS 1371 Introduction to Computing for Engineers PLOTTING.
Plotting – 3-Dimensional. 3D Plots versus 2D Plots 3-dimensional plots, in contrast to 2-dimensional ones, has a third axis (often called the z-axis).
Digital Image Processing Lecture 14: GUI using Matlab
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.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
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 --
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.
General Computer Science for Engineers CISC 106 Lecture 11 James Atlas Computer and Information Sciences 07/27/2009.
MATLAB Tutorial EE 327 Signals and Systems 1. What is MATLAB? MATLAB – Matrix Laboratory The premier number-crunching software Extremely useful for signal.
MA/CS 3751 Fall 2002 Lecture 24. MA/CS 3752 ginput ginput is a Matlab function which takes one argument input: number of points to select in the image.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room , Chris Hill, Room ,
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.
Graphical User Interfaces Tonga Institute of Higher Education.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Introduction to MATLAB Session 5 Simopekka Vänskä, THL 2010.
© Copyright 2012 by Pearson Education, Inc. All Rights Reserved. Chapter 9 GUI Programming Using Tkinter 1.
Introduction to Matlab & Data Analysis 2015 In this tutorial we will: Build a practical application using GUIDE Learn more about graphical user interface.
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.
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.
Numerical Analysis 3D Plots. A numerical method is a technique for computing a numerical approximation of the solution to a mathematical problem.
Recap Chapter 5 “Plotting” Two Dimensional Plots Simple x-y Plots Titles, Labels and Grids Multiple Plots.
The Hong Kong Polytechnic University Industrial Centre 1 MatLAB Lesson 9 : Introduction to GUI & Revision Edward Cheung Room W311g.
Recap Plots with More than one Line Plots of Complex Arrays Line, Color and Mark Style Axis Scaling and Annotating Plots Subplots Polar Plots Logarithmic.
Creating visual interfaces in python
ELG 3120 Lab 2 TAs Wei Zhang Ozgur Ekici (Section A) (Section B)
EGR 115 Introduction to Computing for Engineers
Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab 10: 3D & Projections Advanced.
Computer Science [3] Java Programming II - Laboratory Course Lab 4 -1 : Introduction to Graphical user interface GUI Components Faculty of Engineering.
Program design and algorithm development We will consider the design of your own toolbox to be included among the toolboxes already available with your.
Introduction to Matlab Module #10 Page 1 Introduction to Matlab Module #10 – Creating Graphical User Interfaces Topics 1.Overview of GUI Development using.
MATLAB and SimulinkLecture 61 To days Outline Graphical User Interface (GUI) Exercise on this days topics.
EEE 242 Computer Tools for Electrical Engineering
Graphical User Interfaces I
Topics Graphical User Interfaces Using the tkinter Module
Graphical User Interface in MATLAB
3D-Graphs A 3D surface is defined as: z = f(x, y)
Ch3 Graphics Overview of Plotting Editing Plots
Lecture 25: Exploring data
Chap 7. Building Java Graphical User Interfaces
More on Graphical User Interfaces
Graphical User Interfaces -- Introduction
MATLAB Tutorial Dr. David W. Graham.
Chapter 13 Sights and Sounds.
Yang-Ming University, Taipei, Taiwan
Topics Graphical User Interfaces Using the tkinter Module
Presentation transcript:

More Matlab Graphics and GUI Graphics subplots some useful commands 3D graphics GUI GUI controls The callback property Other essential properties

Comments about the “Game of Life” Initial universe Time step

input universe embed output universe Count neighbors Make decisions

Count neighbors input universe Count the neighbors of a cell Matrix with the neighbors numbers

Subplots Subplot I Subplot II

h1 = subplot(7,7,[ ]);

h1 = subplot(7,7,[ ]); get(h1,'type') ans = axes

h2=axes

subplot(7,7,[7 14])

h1 = subplot(7,7,[ ]);

The interactively edited figure/axes/object is accessible through the gcf/gca /gco commands (get current figure/axes/object). >> get(gca) ALim = [0 1] ALimMode = auto AmbientLightColor = [1 1 1] Box = on CameraPosition = [ ] CameraPositionMode = auto CameraTarget = [ ] CameraTargetMode = auto CameraUpVector = [0 1 0] CameraUpVectorMode = auto CameraViewAngle = [ ] CameraViewAngleMode = auto : Useful Commands

plot(x,y)

hl=findobj(gcf,’type’,’line’)

set(h1,'color','r');

set(gcf,'tag','first‘); Figure; y = x.^-2; plot(x,y);

firstFigure = findobj('tag','first'); h2 = findobj(firstFigure,'type','line') set(h2,'marker','*');

firstFigure = findobj('tag','first'); h2 = findobj(firstFigure,'type','line') set(h2,'marker','*');

3D graphics x = [-2:0.2:2] x = [ … ] y = [-4:0.4:4] y = [ … ] We want to calculate and displayZ=x(x 2 -y 2 )

3D graphics surf(XX,YY,ZZ) size(XX) ans = XX(1:5,1:5) ans = ….. replica of x length(y) rows

surf(XX,YY,ZZ) size(XX) ans = XX(1:5,1:5) ans = …..

surf(XX,YY,ZZ) size(XX) ans = XX(1:5,1:5) ans = …..

3D graphics surf(XX,YY,ZZ) size(YY) ans = YY(1:5,1:5) ans = … … … … ….. replica of y Length(x) columns

3D graphics surf(XX,YY,ZZ) size(ZZ) ans = ZZ = XX.*(XX.^2-YY.^2); Element-by-element matrix operations

How do we create XX and YY? [XX YY] = meshgrid(x,y); Were [XX YY] = meshgrid(x) is the same as [XX YY] = meshgrid(x,x);

How does Matlab know how to relate some value with a specific color? Colormaps! A colormap is an m-rows by 3 column matrix Each row is a color specified in RGB values (between 0 and 1) C=get(1,'colormap') C =

colormap(cool) “colormap” is a property of the figure

colormap(colorcube)

The same plot as a contour map colormap(jet) contour(XX,YY,ZZ,100)

… and with a colorbar colorbar

Solid shading We can change the way the surface displays by changing its shading: >>shading flat faceted %default interp >>surf(peaks) %creates 49 by 49 matrix % an plots its values %against x,y indices flat faceted interpolated

Every axes has a property called ‘view’ that controls the azimuth (az) and elevation (el) of the viewpoint To change the viewpoint we use either: view(az,el) or set(axes_handle,’View’,[az el])

>>view(-37.5,30) >>view(-10.0,30) >>view(0,30)>>view(0,0)

Special 3d plots contour3(x,y,z,n) %create n realistic contours interpreting z %as the height from the x y plane. If specified % x and y should have the same size as z >>contour3(topo,30) >>axis off

Special 3d plots We can create a sphere or a cylinder (of radius =1) with little effort >>[x,y,z]=sphere; %will compute the required % N+1 (N=20 by default) coordinates so >>surf(x,y,z) %will plot sphere surface >>axis equal Note:  sphere without left arguments will plot the surface.  sphere(n) use n instead of the default of 20

Special 3d plots To create a cylinder we issue the following command: >>[x,y,z]=cylinder; >>surf(x,y,z)%this creates a basic cylinder of %radius 1

We can also create cylinder with reference to a specific profile. We will now generate a cylinder with the e sin(t) profile >> t = 0:pi/10:2*pi; >> [X,Y,Z] = cylinder(exp(sin(t))); >> surf(X,Y,Z) Special 3d plots

Graphical User Interfaces Why? Built in UIs Uicontrols GUI programming

Every day examples

GUI examples

Graphic Objects figure axes 2D-plot 3D-plot axis labels title GUI objects pushbutton toggle edit text menu

1.Enable you to share your work with other people (your advisor/lab mates or grandmother) 2.Easy way to perform repetitive task that need constant user input 3.Create interactive demos to your applications 4.It’s fun… Motivation or why GUIs?

GUI components Figure window GUI controllers which are divided into two major classes: uimenu (like the File,Edit etc) uicontrols (buttons, lists, radio buttons pop-up list like in any other application) uimenu and uicontrols are children of the figure If an uimenu is implemented as submenu, then it is a child of another uimenu

The UIcontrols are common interface controlers Help us perform specific actions or set the variables for future actions Actions and options are selected by the mouse, some UIcontrols are also editable so we can use the keyboard as well Interface controllers

We can create UIcontrols simply by implementing the following syntax handle_to_UI=uicontrol(‘Property Name’,’Property Value’);

Interface controllers UIcontrol types are defined by their ‘style’ property: Check box 'checkbox'Editable text field 'edit' Toggle button 'toggle' 'Pop-up menus 'popupmenu' Push button 'pushbuttonList box 'listbox' Radio button 'radiobutton' Static text 'text' Slider 'slider'Frame 'frame'

Interface controllers are graphic objects Essential properties: Callback – A string with one or more commands that is executed when the controller is activated. May be empty – ''

Example uicontrol('style','pushbutton','callback','close(gcf)');

Interface controllers are graphic objects Essential properties: Callback – A string with one or more commands that is executed when the controller is activated. May be empty - '' Recommendation – always call a function that does what you want.

Interface controllers are graphic objects Essential properties: Callback – A string with one or more commands that is executed when the controller is activated. May be empty - '' Recommendation – always call a function that does what you want. Tag – a string that may be used as a unique identifier of the controller. h = findobj('Tag','1');