Debugging M-Files Steve Gu Feb 08, 2008. Outline What’s Debugging? Types of Errors Finding Errors Debugging Example Using Debugging Features.

Slides:



Advertisements
Similar presentations
COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Advertisements

Why care about debugging? How many of you have written a program that worked perfectly the first time? No one (including me!) writes a program that works.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Debugging in Matlab C. Reed 4/5/11. Bugs Debugging is a natural part of programming: Three standard types of errors: –Syntax errors: you simply have typed.
Lecture 7 Debugging Code & Data Import/Export © 2007 Daniel Valentine. All rights reserved. Published by Elsevier.
General Computer Science for Engineers CISC 106 Lecture 21 Dr. John Cavazos Computer and Information Sciences 04/10/2009.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
Lec6 P 1 CP2030 Visual Basic For C++ programmers Copyright © University of Wolverhampton CP2030 VBFC Lecture 6 Back To Index v Procedures and Parameters.
Finding and Debugging Errors
Visual Basic Debugging Tools Appendix D 6/27/20151Dr. Monther Aldwairi.
JavaScript, Fourth Edition
DEBUGGERS For CS302 Data Structures Course Slides prepared by TALHA OZ (most of the text is from
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.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Lecture 1: Introduction Lecture series based on the text: Essential MATLAB for Engineers and Scientists By Hahn & Valentine
Debugging Cluster Programs using symbolic debuggers.
ASP.NET Programming with C# and SQL Server First Edition Chapter 6 Debugging and Error Handling.
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
Debugging applications, using properties Jim Warren – COMPSCI 280 S Enterprise Software Development.
Debugging UC Berkeley Fall 2004, E77 Copyright 2005, Andy Packard. This work is licensed under the Creative Commons.
Debugging Projects Using C++.NET Click with the mouse button to control the flow of the presentation.
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
Copyright © The McGraw-Hill Companies, Inc. Introduction to MATLAB for Engineers, Third Edition William J. Palm III Chapter 1 An Overview of MATLAB.
Python From the book “Think Python”
Debugging in Java. Common Bugs Compilation or syntactical errors are the first that you will encounter and the easiest to debug They are usually the result.
A Brief introduction to MatLAB ($50 - $99 for students)
SUNY-New Paltz Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz “Lecture 6”
ME 142 Engineering Computation I Debugging Techniques.
VB – Debugging Tools Appendix D. Why do we need debugging? Every program has errors, and the process of finding these errors is debugging Types of errors.
FIRST JAVA PROGRAM. JAVA PROGRAMS Every program may consist of 1 or more classes. Syntax of a class: Each class can contain 1 or more methods. public.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
Structured Programming: Debugging and Practice by the end of this class you should be able to: debug a program using echo printing debug a program using.
Debugging and Profiling With some help from Software Carpentry resources.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
1 Original Source : and Problem and Problem Solving.ppt.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 8 What’s Wrong with It?
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 6: Debugging in MATLAB Monday 15 Sept 2014 EGR 115 Introduction to Computing for Engineers.
CSC 1010 Programming for All Lecture 2 Introduction to Python Some material based on material from Marty Stepp, Instructor, University of Washington.
CS 177 Week 10 Recitation Slides 1 1 Debugging. Announcements 2 2.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
E Copyright © 2007, Oracle. All rights reserved. Using JDeveloper.
JavaScript, Sixth Edition
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. Chapter 2 C++ Basics.
Chapter 7 What’s Wrong with It? (Syntax and Logic Errors) Clearly Visual Basic: Programming with Visual Basic nd Edition.
COMPUTER PROGRAMMING I SUMMER Understand Different Types of Programming Errors.
Structured Computer Programming EE 201 Introduction to MATLAB 7 for Engineers بسم الله الرحمن الرحيم King Abdulaziz University College of Engineering Dept.
Debugging using By: Samuel Ashby. What is debugging?  A bug is an error in either a program or the hardware itself.  Debugging is first locating and.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
L AB #3. System.out.println(“if you have” +eggPerBasket + “egg per basket and” + numberOfBaskets +”baskets, then the total number off eggs is“+totalEggs);
Mobile Device Development
ME 142 Engineering Computation I
Testing and Debugging.
DEBUGGING.
Today’s lesson – Python next steps
Detecting and Resolving Model Errors
DEBUGGING JAVA PROGRAMS USING ECLIPSE DEBUGGER
Tonga Institute of Higher Education
Testing, debugging, and using support libraries
Basic Debugging (compilation)
Debugging Visual Basic Programs
IDE’s and Debugging.
Scratch Programming Lesson 7 Debugging.
Programming for Business Computing Introduction
Presentation transcript:

Debugging M-Files Steve Gu Feb 08, 2008

Outline What’s Debugging? Types of Errors Finding Errors Debugging Example Using Debugging Features

What’s Debugging? Debugging is the process by which you can – Recognize a bug exists – Isolate source of bug – Identify cause of bug – Determine fix for bug

Types of Errors Syntax Errors – Misspelling – Omitting parenthesis – MATLAB detects most syntax error and display error message in the command window Run-time Errors – Modify the wrong variables – Perform a calculation incorrectly – Apparent when an M-file produces unexpected result

Find Errors For syntax errors – Easy – MATLAB’s error messages For Run-time errors – More difficult – Some useful techniques: Remove ; Add keyboard statements  K>>  type return Run M-file as a script Use the ‘depfun’: e.g,list = depfun('binomial','-toponly'); Use the MATLAB Editor/Debugger or debugging functions

Debugging Example –Binomial.m

Using Debugging Features Preparing for Debugging Setting Breakpoints Running an M-File with Breakpoints Stepping through an M-File Examining Values Correcting Problems and Ending Debugging

Preparing for Debugging Open the file – To use the Editor/Debugger Save changes

Setting Breakpoint Setting Breakpoints Using the Editor – Set/Clear Breakpoint Function Equivalent – dbstop in binomial at 14 – Some Useful related functions dbtype :Lists the M-file code dbstatus :Lists breakpoints

Running an M-File with Breakpoints Run M-file from command window or Editor K>> MATLAB is in debug mode The program is paused at the first breakpoint The function displayed in the Stack changes to reflect the current function

Stepping Through an M-File

Examining Values Viewing Datatips in the Editor/Debugger Viewing Values in the Array Editor

Viewing Values in Array Editor

Ending Debugging Quit Debugging Clear all the breakpoints in the file Make changes to the M-file Save M-file