Robert’s Rules of Matlab. Disclaimer: My usual processing flow is to use c or fortran codes linked together via tcsh scripts. I find Matlab to be really.

Slides:



Advertisements
Similar presentations
StatLab Workshop Yale University Maximiliano Appendino, Economics October 18 th, 2013.
Advertisements

Chapter 8 and 9 Review: Logical Functions and Control Structures Introduction to MATLAB 7 Engineering 161.
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.
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)
MIRC Matthew Forest. Introduction mIRC itself is a program designed for text based messaging via the IRC (internet relay chat) protocol. (Link:
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
Introduction to MATLAB Northeastern University: College of Computer and Information Science Co-op Preparation University (CPU) 10/22/2003.
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
Introduction to JavaScript for Python Programmers
Introduction to programming in MATLAB MATLAB can be thought of as an super-powerful graphing calculator Remember the TI-83 from calculus? With many more.
Digital Image Processing Lecture3: Introduction to MATLAB.
EPSII 59:006 Spring Topics Using TextPad If Statements Relational Operators Nested If Statements Else and Elseif Clauses Logical Functions For Loops.
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.
Nonparametric Econometrics1 Intro to Matlab for Data Analysis and Statistical Modeling.
Each VI has 2 Windows Front Panel User Interface (UI) –Controls = Inputs –Indicators = Outputs Block Diagram Graphical Code –Data travels on wires from.
Microsoft Visual Basic 2005 CHAPTER 9 Using Arrays and File Handling.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 8 Fall 2010.
Using Arrays and File Handling
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)
Matlab GUIs GUIDE.
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Forms - An Overview of Oracle Form Builder v.6.0 Abhishek Parag Prashant Arun.
Introduction to Matlab & Data Analysis
Recap Graphic Window Edit Window Start Button Matrices in MATLAB Scalar Operations Order of Operations Array Operations Matrix Addition Matrix Multiplication.
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
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.
Copyright © Curt Hill Java Looking at our first console application in Eclipse.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
Tot 15 LTPDA Graphic User Interface summary and status N. Tateo 26/06/2007.
Chapter 19: Visual Lisp. After completing this Chapter, you will be able to do the following: What is AutoLISP Launching Visual LISP Terminology and Fundamental.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2010.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Introduction to Matlab’s Graphical User Interface (GUI) Type “guide” “Guide” creates interface on a Figure window and code in an M-file. Some hidden code.
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.
CMPS 1371 Introduction to Computing for Engineers CONDITIONAL STATEMENTS.
CMPS 1371 Introduction to Computing for Engineers MatLab.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
Digital Electronics and Computer Interfacing Tim Mewes 4. LabVIEW - Advanced.
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.
Build-A-Button Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, October 8, 2003.
XP Tutorial 8 Adding Interactivity with ActionScript.
An Introduction to Designing, Executing and Sharing Workflows with Taverna Katy Wolstencroft myGrid University of Manchester IMPACT/Taverna Hackathon 2011.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Introduction to MATLAB 7 MATLAB Programming for Engineer Hassan Migdadi Spring 2013.
GUI development with Matlab: GUI Front Panel Components GUI development with Matlab: Other GUI Components 1 Other GUI components In this section, we will.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2012.
Basics of Windows 95/98/NT. Versions of Windows Windows 95 and 98 used mainly on standalone computers Windows NT used on networked computers (as in our.
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.
PATTERN RECOGNITION LAB 8 TA : Nouf Al-Harbi::
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
Gene Information GUI By David Bittner. Goal of GUI The website Genecards.org is a database of all known genes that collects data from dozens of sources.
Together we can build something great FORWARD | 2016 Role Centers and Charting Joanna Broszeit, Dawn Stenbol, Tracie Folscroft Education Track | Boston.
CSC 108H: Introduction to Computer Programming Summer 2011 Marek Janicki.
Graphical User Interfaces I
Forms Concepts Triggers Fired when Internal/External events occur
Release Numbers MATLAB is updated regularly
Visual Basic Code & No.: CS 218
Digital Image Processing
Presentation transcript:

Robert’s Rules of Matlab

Disclaimer: My usual processing flow is to use c or fortran codes linked together via tcsh scripts. I find Matlab to be really great for easy to code routines which require user interaction. Instances include SplitLab and FuncLab as you will learn later this week, quality control of ambient noise correlations, and determination of discontinuities from 1D shear velocity and Receiver Functions.

Poker Matlab is not only for data processing. From the Matlab command window, type “poker” to launch a very simple draw poker game I wrote in What is this code? Input user parameters Set the random number generator While (player has chips or decides not to cash out) Generate a hand display hand allow user to exchange cards display new hand analyze results and pay out End while

Getting help This is the first block of comments in the.m file displayed when the user types: >> help command.m

Pre-allocate your arrays 30x speedup!

Matrices and array notation Matlab is built on the idea that everything is a matrix (or vector). Much faster than nested for loops

The cell array A cell array can be seen as an array of matrices. Each matrix can be its own size and type. Where matrix/vector elements can be accessed by enclosing the indices in parentheses ( ), cell arrays use squiggly brackets { }.

Structures variable.element think of structures as a handy way to keep track of, pass, and handle ‘objects’ with common properties. In the example here, I use a ‘station’ with some common parameters. I can then operate on a structure variable if I know what all properties it contains.

Avoid the parfor temptation To parallelize a Matlab for loop, all you have to do is: 1.Change “for” to “parfor” 2.Open a pool of Matlab works to run the parallel loop BUT I suggest avoiding this. Why? Matlab relies on built-in algorithms that are already optimized and often are already parallel. Therefore, if you override that optimized parallel code with a non-optimized block, you’re likely to see drops in performance because the resources are not available for the optimized function. Furthermore, there is a cost of parallelization – namely message passing. Each time a parallel block is entered, the processor has to figure out and send information to the nodes before the parallel job even begins.

Avoid toolboxes in distributed code Toolboxes are great extensions to Matlab, but for a single user license they cost ~$45 each in addition to the ~$150 base cost. Institutional costs are order of $500 for the base and ~$100 per toolbox. Therefore you can’t assume other users of your code will have access to the same set of toolboxes. Need a toolbox function? Is it simple? Write it yourself. Is it not simple? Google the usage; sometimes you will find a drop in replacement For instance, in some of the SRF codes we use at USC will rely on reckon.m from the mapping toolbox. We recently found geodreckon.m, which is nearly a drop in replacement freely available online from the author (Charles Karney).

Pandora’s box: UI control uimenu sets menu items such as file->open or edit->select all uipanel creates a grouped background useful for arranging user control uicontrol creates an instance of some user interactive widget such as a button, popup menu, editable text box, radio buttons, etc… When one of these items is activated (ie button pressed) it enacts what is called a ‘callback function’. Making a GUI is all about designing the button layout and then coding the set of callback functions to process the data as input by the user.

Search for existing code! The real value of Matlab is its extensive code/user base. Developers from across the sciences all use Matlab and contribute new code which may help you make a new discovery. Many of these codes can be found on xchange

Think “Processing Flow” rather than just processing Who wants to click once per seismogram? When you’re dealing with big data, its only practical to have the data (not just waveform) flow through filters and processes to develop the final product. You will see this in FuncLab and SplitLab. Half of the work is just setting up the workflow and then hitting a button to actually run the processing flow. Things like sac or the matlab command line are great for interactively experimenting with small data. But once you want to scale up, you need to think through as many possibilities as you can.

Some useful packages: m_map seizmo the waveform suite coral processRFmatlab FuncLab SplitLab irisFetch.m + IRIS-WS jar