Matlab Input/Output. Goal of this section Learn user-controlled Input Output Read/write data files (optional) Input/output 5-
|
|
- Geoffrey Byrd
- 5 years ago
- Views:
Transcription
1 Matlab Input/Output Goal of this section Learn user-controlled Input Output Read/write data files (optional) Input/output 5-1
2 Input: initialization >> a=[ ; 1 1 0] >> b=[1, 2, 3; 2:4] >> b=[1, 2, 3, 2:4] >> b=linspace(3, 5, 5) >> c=[b, 2:4] >> d=[pi, linspace(3, 5, 5)] Input/output 5-2
3 Input: data file >>load a9q1.dat >>% load full_filename (i.e. including.dat) >>% load data to an array named filename Input/output 5-3
4 Input: by command >>grade = input(' key in your lab 5 grade:' ) >>grade = input('key in your lab 5 grade:' ) >>grade = input('key in your lab 5 grade:' ); >>grade = input('key in your lab 5 grade\n' ) % \n: new line >>grades = input(' key in your labs 1-5 grades inside a [ ]:' ) >>% Matlab take the data and assign to variable >>% keyboard input should be sparse, use data files if available Input/output 5-4
5 Output: data file >> save a9q1.dat temp -ASCII >>% save filename array -ASCII Input/output 5-5
6 Printing: text or one matrix Unformatted: disp('text') or disp (matrix) >> disp('pi='), disp(pi) pi= >> a=[1 2 ;3 4]; >> a a = >> disp(a) Input/output 5-6
7 Printing: text and #s in one line Unformatted: disp( ['text', num2str(#)] ) >> disp('pi='), disp(pi) pi= >> disp( ['pi=', num2str(pi)] ) %num2str: number to string pi= >>% text= ['pi=', num2str(pi)], disp(text) % try the following % disp( ['pi=' ; num2str(pi)] ) % disp( ['pi=' num2str(pi)] ) % disp( ['pi=', num2str(pi), ', final answer' ] ) % disp( ['pi=, 2pi=', num2str(pi, 2*pi)] ) % disp( ['pi=', num2str(pi), '2*pi=', num2str(2*pi)] ) % disp( ['pi=', num2str(pi, 2)] ) 7
8 Printing: text and #s in one line Unformatted: disp( ['text', num2str(a row vector)] ) >> a=[ 1 2 3] >> disp(['a=', num2str(a)] ) a=1 2 3 >> a=[ 1; 2; 3] >> disp(['a=', num2str(a)] ) >> disp(['a=', num2str(a')] ) >> a=[ 1 2 3; 4 5 6] >> disp(['a=', num2str(a)] ) Input/output 5-8
9 Printing: text and matrices Formatted: fprintf ('format', list of matrices) >> a a = >> fprintf ('a= %f', a) % Matlab is column dominant a= a= a= a= >> fprintf ('%.2f, %.2f \n',a) 1.00, , 4.00 >> %recycle format by column >> fprintf ('%.2f \t %.2f \n',a') % \t jump to the next tab Input/output 5-9
10 Printing: text and matrices Formatted: fprintf ('format', list of matrices) >> temp=0:20:100; >> tempk= temp tempk = >> table= [temp; tempk] table = >> disp('temp tempk');fprintf('%.2f\t%.2f\n', temp, tempk) temp tempk
11 Printing: text and matrices Formatted: fprintf ('format', list of matrices) Try the following: fprintf('\n %2\t%2', table) fprintf('\n %,2\t%,2', table) fprintf('\n %,2f\t%,2f ', table) fprintf('\n 8.2f%\t%8.2f%', table) fprintf('\n %.2f\t%,2f ', table) fprintf('\n %,2f\t%.2f ', table) fprintf('\n %.2f,\t%.2f ', table) 11
12 Printing: text and matrices Formatted: fprintf ('format', list of matrices) temp=0:20:100; >> tempk= temp tempk = >> table= [temp; tempk] table = >> disp('temp tempk');fprintf('\n %.2f\t%.2f', table) temp tempk
13 Printing: text and matrices To form a table for printing >> table= [temp; tempk] table = >> disp(' temp tempk '),disp (table') temp tempk
14 Printing: text and matrices To form a table for printing >> table1 (:,1)=temp'; >> table1 (:,2)=tempk' table1 = >>disp(' temp tempk '), disp (table1) Input/output 5-14
15 % name % student # % section 51 % Sep 26, 2013 % assignment 3 format compact clear, clc Coding Style (m-file) disp ('name') disp ('student #') disp ('lab51') disp ('assignment 3') disp ('Sep 26, 2013') %a3q1 disp ( ---a3q1---') TC=1:5; TK= TC; Table=[TC' TK ] create a header and modify it each time format compact to save $ clear to clear memory clc to clear command window use disp to print header use blank lines to break program into sections use disp to print a3q1, a3q2 etc
16 Coding Style (M-file) disp(' ') disp('- Paul Paterson -') disp('- SID: ### ### ### -') disp(' ') disp(' Assignment #3 ') disp(' Lab Section 52 ') disp(' Date: Sept. 22, 2010 ') disp(' ') disp(' ') % Question a3q1 - Code disp('question a3q1')
17 syntax fprintf('format_string',argument_list); example fprintf('month=%5d \n',month); output month= example output area= 1 2 Format conversion specification fprintf('area=%9.2f perimeter=%9.4f \n, area,perimeter); perimeter= %w.p: first part of conversion (w) specification is the field width second part (p), if used is the precision (how many decimal places) Input/output 5-17
18 Format complete structure of format specifications for int and float type data %[flag][field width][.precision]type parts in [ ] are optional flags, - left justify, +right justify and add +ve sign if number positive, 0 adds zeros to the left side of the numbers to fill the entire field if needed if flag is not used, the number is right justified if field width is not specified, the field width will automatically be made large enough to accommodate the entire number if precision is not specified, then a default precision (6) will be used regardless of format bank (2), short (5) and long (15) etc. type -d for integer type data -f for float type data -e or E for float type data to be put out in scientific notation almost identical to C refer to Table 7.1 (2e p234, 3e p247) for format specs 18
19 Format everything inside the format string will be used, including space, $, ;,,, etc Examples: fprintf('area=%9.2f perimeter=%9.4f\n',area,perimeter) fprintf('area=%9.2f,perimeter=%9.4f\n',area,perimeter) fprintf('area=%9.2f;perimeter=%9.4f\n',area,perimeter) fprintf('area=%9.2f perimeter=%9.4f\n',area,perimeter) fprintf('cost=$%-9.2f\n',cost) fprintf('cost saving=%-9.2f%%\n',costsaving) Input/output 5-19
20 Line Feed grade = input('key in your lab 4 grade:' ); grade = input('key in your lab 5 grade:' ); disp('line 1'); disp('line 2'); Input/output 5-20
21 Formatting Output how do we control things like line feeds etc. % this will not line feed fprintf('line 1'); fprintf('line 2'); disp('line 3'); % this will line feed fprintf('line 1\n'); fprintf('line 2\n'); disp('line 3\n'); disp('line 4\n'); line 1 line 2 line 3\n line 4\n line 1line 2line Input/output 5-21
22 Formatting Output which one is correct to generate a blank line fprintf('line 1\n\n'); fprintf('line 2\n'); fprintf('line 1\nn'); fprintf('line 2\n'); fprintf('line 1\2n'); fprintf('line 2\n'); fprintf('line 1\n'); fprintf('\n'); fprintf('line 2\n'); fprintf('line 1\n'); disp(' '); fprintf('line 2\n'); Input/output 5-22
23 Formatting Input which one will line feed and where grade = input('key in your lab 4 grade:' ); grade = input('key in your lab 5 grade:' ); grade = input('key in your lab 4 grade:\n' ); grade = input('key in your lab 5 grade:' ); grade = input('key in your lab 4 grade:' ); grade = input('\nkey in your lab 5 grade:' ); Input/output 5-23
24 Formatting Input which one will line/tab feed and where grade = input('key in your lab 4 grade:\t' ); grade = input('key in your lab 4 grade:\n\t'); 00 grade = input('\tkey in your lab 5 grade:' ); Input/output 5-24
25 Write data to a file: syntax file_id=fopen('filename.txt', 'wt' ); % open input file, or create a file id (pointer) fprintf(file_id,'format_string',argument_list); % write to file file_id, note the real file % name is no longer used % number of bytes written (to file) in ans % use fclose (file_id) to close the file Input/output 5-25
26 Write data to a file: example t_ck=fopen('temp_table.txt', 'wt ' ) temp=0:20:100; tempk= temp; table= [temp;tempk] %fprintf('temp tempk'); % this will help you debug %fprintf(t_ck, 'temp tempk'); fprintf('\n %.2f\t%.2f', table) % this will help you debug fprintf(t_ck, '\n %.2f\t%.2f', table) fclose(t_ck); % remember to close all files Input/output 5-26
27 Read data from a file Import Wizard requires interaction with the user, which is extremely undesirable in high level computer programming. Read data from a file by command, syntax [data, fs, up] = xlsread ('filename.xls'); % numeric to data % file string (text) to fs % unprocessed to up [array] = csvread ('filename.txt'); % file has numeric only % values to array Input/output 5-27
28 Write data to a file syntax xlswrite ('filename.xls', array); % write array into filename % as excel worksheet csvwrite ('filename.txt', array); % write array into filename % as comma separated values Input/output 5-28
29 Lessons Learned each input (function) starts a new line (before or after?) can format input with line feed each disp starts a new line (before or after?) can not format disp (unformatted) num2str to convert better to have a table before printing disp easy to use, but only one array at a time fprintf offer control over position and digits, but by column be careful with input/output file format use numbers for now, you will learn how to handle strings in other courses Input/output 5-29
30 Your Tasks Read Chapter 7 Do lab assignment # Input/output 5-30
CSE 123. Lecture 9. Formatted. Input/Output Operations
CSE 123 Lecture 9 Formatted Input/Output Operations fpintf function writes formatted data in a user specified format to a file fid fprintf Function Format effects only the display of variables not their
More informationES 117. Formatted Input/Output Operations
ES 117 Formatted Input/Output Operations fpintf function writes formatted data in a user specified format to a file fid fprintf Function Format effects only the display of variables not their values through
More informationImporting and Exporting Data
Class14 Importing and Exporting Data MATLAB is often used for analyzing data that was recorded in experiments or generated by other computer programs. Likewise, data that is produced by MATLAB sometimes
More informationLecture 5: Strings, Printing, and File I/O
1 Lecture 5: Strings, Printing, and File I/O 1 Learning objectives At the of this class you should be able to... be able to name the three Matlab data types most commonly used in ME 352 be able to use
More informationPROGRAMMING WITH MATLAB WEEK 13
PROGRAMMING WITH MATLAB WEEK 13 FILE INPUT AND OUTPUT Input statements read in values from the default or standard input device. In most systems the default input device is the keyboard. The input expression
More informationInteractive MATLAB use. Often, many steps are needed. Automated data processing is common in Earth science! only good if problem is simple
Chapter 2 Interactive MATLAB use only good if problem is simple Often, many steps are needed We also want to be able to automate repeated tasks Automated data processing is common in Earth science! Automated
More informationProgramming 1. Script files. help cd Example:
Programming Until now we worked with Matlab interactively, executing simple statements line by line, often reentering the same sequences of commands. Alternatively, we can store the Matlab input commands
More informationBeyond the Mouse A Short Course on Programming
1 / 14 Beyond the Mouse A Short Course on Programming 5. Matlab IO: Getting data in and out of Matlab Ronni Grapenthin and Glenn Thompson Geophysical Institute, University of Alaska Fairbanks October 10,
More informationMATLAB Introduction to MATLAB Programming
MATLAB Introduction to MATLAB Programming MATLAB Scripts So far we have typed all the commands in the Command Window which were executed when we hit Enter. Although every MATLAB command can be executed
More informationMatlab Programming Arrays and Scripts 1 2
Matlab Programming Arrays and Scripts 1 2 Mili I. Shah September 10, 2009 1 Matlab, An Introduction with Applications, 2 nd ed. by Amos Gilat 2 Matlab Guide, 2 nd ed. by D. J. Higham and N. J. Higham Matrix
More informationMATLAB User-defined functions, Data Input/Output. Edited by Péter Vass
MATLAB User-defined functions, Data Input/Output Edited by Péter Vass User-defined functions Although, MATLAB provides a wide range of built-in functions it may often be necessary to create and use an
More informationWorksheet 6. Input and Output
Worksheet 6. Input and Output Most programs (except those that run other programs) contain input or output. Both fortran and matlab can read and write binary files, but we will stick to ascii. It is worth
More informationProgramming in Mathematics. Mili I. Shah
Programming in Mathematics Mili I. Shah Starting Matlab Go to http://www.loyola.edu/moresoftware/ and login with your Loyola name and password... Matlab has eight main windows: Command Window Figure Window
More informationChapter 2. MATLAB Basis
Chapter MATLAB Basis Learning Objectives:. Write simple program modules to implement single numerical methods and algorithms. Use variables, operators, and control structures to implement simple sequential
More informationChapter 3: Introduction to MATLAB Programming (4 th ed.)
Chapter 3: Introduction to MATLAB Programming (4 th ed.) Algorithms MATLAB scripts Input / Output o disp versus fprintf Graphs Read and write variables (.mat files) User-defined Functions o Definition
More informationAn Introduction to MATLAB
An Introduction to MATLAB Day 1 Simon Mitchell Simon.Mitchell@ucla.edu High level language Programing language and development environment Built-in development tools Numerical manipulation Plotting of
More information5. MATLAB I/O 1. Beyond the Mouse GEOS 436/636 Jeff Freymueller, Sep 26, The Uncomfortable Truths Well, hop://xkcd.com/568 (April 13, 2009)
5. MATLAB I/O 1 Beyond the Mouse GEOS 436/636 Jeff Freymueller, Sep 26, 2017 The Uncomfortable Truths Well, hop://xkcd.com/568 (April 13, 2009) Topics Loading and Saving the Workspace File Access Plo$ng
More informationNumerical Analysis First Term Dr. Selcuk CANKURT
ISHIK UNIVERSITY FACULTY OF ENGINEERING and DEPARTMENT OF COMPUTER ENGINEERING Numerical Analysis 2017-2018 First Term Dr. Selcuk CANKURT selcuk.cankurt@ishik.edu.iq Textbook Main Textbook MATLAB for Engineers,
More informationLesson 2 Characteristics of Good Code Writing (* acknowledgements to Dr. G. Spinelli, New Mexico Tech, for a substantial portion of this lesson)
T-01-13-2009 GLY 6932/6862 Numerical Methods in Earth Sciences Spring 2009 Lesson 2 Characteristics of Good Code Writing (* acknowledgements to Dr. G. Spinelli, New Mexico Tech, for a substantial portion
More informationProgramming in MATLAB
2. Scripts, Input/Output and if Faculty of mathematics, physics and informatics Comenius University in Bratislava October 7th, 2015 Scripts Scripts script is basically just a sequence of commands the same
More informationUnit 4. Input/Output Functions
Unit 4 Input/Output Functions Introduction to Input/Output Input refers to accepting data while output refers to presenting data. Normally the data is accepted from keyboard and is outputted onto the screen.
More informationLecture 7. MATLAB and Numerical Analysis (4)
Lecture 7 MATLAB and Numerical Analysis (4) Topics for the last 2 weeks (Based on your feedback) PDEs How to email results (after FFT Analysis (1D/2D) Advanced Read/Write Solve more problems Plotting3Dscatter
More informationAMS 27L LAB #2 Winter 2009
AMS 27L LAB #2 Winter 2009 Plots and Matrix Algebra in MATLAB Objectives: 1. To practice basic display methods 2. To learn how to program loops 3. To learn how to write m-files 1 Vectors Matlab handles
More informationChapter 11 Input/Output (I/O) Functions
EGR115 Introduction to Computing for Engineers Input/Output (I/O) Functions from: S.J. Chapman, MATLAB Programming for Engineers, 5 th Ed. 2016 Cengage Learning Topics Introduction: MATLAB I/O 11.1 The
More informationUsing files. Computer Programming for Engineers (2014 Spring)
Computer Programming for Engineers (2014 Spring) Using files Hyoungshick Kim Department of Computer Science and Engineering College of Information and Communication Engineering Sungkyunkwan University
More informationAttia, John Okyere. Control Statements. Electronics and Circuit Analysis using MATLAB. Ed. John Okyere Attia Boca Raton: CRC Press LLC, 1999
Attia, John Okyere. Control Statements. Electronics and Circuit Analysis using MATLAB. Ed. John Okyere Attia Boca Raton: CRC Press LLC, 1999 1999 by CRC PRESS LLC CHAPTER THREE CONTROL STATEMENTS 3.1 FOR
More informationEGR 102 Introduction to Engineering Modeling. Lab 05A Managing Data
EGR 102 Introduction to Engineering Modeling Lab 05A Managing Data 1 Overview Review Structured vectors in MATLAB Creating Vectors/arrays:» Linspace» Colon operator» Concatenation Initializing variables
More informationENGR 1181 MATLAB 09: For Loops 2
ENGR 1181 MATLAB 09: For Loops Learning Objectives 1. Use more complex ways of setting the loop index. Construct nested loops in the following situations: a. For use with two dimensional arrays b. For
More informationIntroduction to MATLAB Programming. Chapter 3. Linguaggio Programmazione Matlab-Simulink (2017/2018)
Introduction to MATLAB Programming Chapter 3 Linguaggio Programmazione Matlab-Simulink (2017/2018) Algorithms An algorithm is the sequence of steps needed to solve a problem Top-down design approach to
More informationCME 192: Introduction to Matlab
CME 192: Introduction to Matlab Matlab Basics Brett Naul January 15, 2015 Recap Using the command window interactively Variables: Assignment, Identifier rules, Workspace, command who and whos Setting the
More informationMATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab
MATH 495.3 (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab Below is a screen similar to what you should see when you open Matlab. The command window is the large box to the right containing the
More informationCMPT 102 Introduction to Scientific Computer Programming. Input and Output. Your first program
CMPT 102 Introduction to Scientific Computer Programming Input and Output Janice Regan, CMPT 102, Sept. 2006 0 Your first program /* My first C program */ /* make the computer print the string Hello world
More information1 >> Lecture 6 2 >> 3 >> -- User-Controlled Input and Output 4 >> Zheng-Liang Lu 367 / 400
1 >> Lecture 6 2 >> 3 >> -- User-Controlled Input and Output 4 >> Zheng-Liang Lu 367 / 400 American Standard Code for Information Interchange (ASCII) 2 Everything in the computer is encoded in binary.
More informationSingular Value Decomposition (SVD) 1
Singular Value Decomposition (SVD) 1 Let A m n be a matrix. Then σ is called one singular value associated with the singular vectors u R m 1 and v R n 1 for A provided that { Av = σu, A T u = σv. We further
More information12 whereas if I terminate the expression with a semicolon, the printed output is suppressed.
Example 4 Printing and Plotting Matlab provides numerous print and plot options. This example illustrates the basics and provides enough detail that you can use it for typical classroom work and assignments.
More informationAccess to Delimited Text Files
Access to Delimited Text Files dlmread(filename, delimiter) reads ASCII-delimited file of numeric data. dlmwrite(filename, M, delimiter) writes the array M to the file using the specified delimiter to
More informationENGR 1181 MATLAB 05: Input and Output
ENGR 1181 MATLAB 05: Input and Output Learning Objectives 1. Create a basic program that can be used over and over or given to another person to use 2. Demonstrate proper use of the input command, which
More informationENG Introduction to Engineering
GoBack ENG 100 - Introduction to Engineering Lecture # 9 Files, Sounds, Images and Movies Koç University ENG 100 - Slide #1 File Handling MATLAB has two general ways of importing/exporting data from the
More informationSIMPLE INPUT and OUTPUT:
SIMPLE INPUT and OUTPUT: (A) Printing to the screen. The disp( ) command. If you want to print out the values of a variable to the screen, you simply can type the variable at the command line. > x = 5
More informationCEMTool Tutorial. Control statements
CEMTool Tutorial Control statements Overview This tutorial is part of the CEMWARE series. Each tutorial in this series will teach you a specific topic of common applications by explaining theoretical concepts
More informationBasic Plotting. All plotting commands have similar interface: Most commonly used plotting commands include the following.
2D PLOTTING Basic Plotting All plotting commands have similar interface: y-coordinates: plot(y) x- and y-coordinates: plot(x,y) Most commonly used plotting commands include the following. plot: Draw a
More informationBASIC INPUT/OUTPUT. Fundamentals of Computer Science
BASIC INPUT/OUTPUT Fundamentals of Computer Science Outline: Basic Input/Output Screen Output Keyboard Input Simple Screen Output System.out.println("The count is " + count); Outputs the sting literal
More informationChapter 3: Programming with MATLAB
Chapter 3: Programming with MATLAB Choi Hae Jin Chapter Objectives q Learning how to create well-documented M-files in the edit window and invoke them from the command window. q Understanding how script
More informationLes s on Objectives. Student Files Us ed
Lesson 3 - Potpourri 31 Lesson 3 P otpourri Les s on Topics The Fill Command Wrapping Text View Options Edit Options Other Fill Handle Uses Les s on Objectives At the end of the lesson, you will be able
More informationScalars and Variables
Chapter 2 Scalars and Variables In this chapter, we will discuss arithmetic operations with scalars (numbers, really an array with only one element) and variables. Scalars can be used directly in calculations
More informationESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 7 Input/Output
ESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 7 Input/Output Reading: Bowman, Chapters 10-12 READING FROM THE TERMINAL The READ procedure is used to read from the terminal. IDL
More informationC How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.
C How to Program, 6/e 1992-2010 by Pearson Education, Inc. An important part of the solution to any problem is the presentation of the results. In this chapter, we discuss in depth the formatting features
More informationC Programming a Q & A Approach
C Programming a Q & A Approach by H.H. Tan, T.B. D Orazio, S.H. Or & Marian M.Y. Choy Chapter 2 Variables, Arithmetic Expressions and Input/Output 2.1 Variables: Naming, Declaring, Assigning and Printing
More informationThere is also a more in-depth GUI called the Curve Fitting Toolbox. To run this toolbox, type the command
Matlab bootcamp Class 4 Written by Kyla Drushka More on curve fitting: GUIs Thanks to Anna (I think!) for showing me this. A very simple way to fit a function to your data is to use the Basic Fitting GUI.
More informationAdvanced C Programming Topics
Introductory Medical Device Prototyping Advanced C Programming Topics, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota Operations on Bits 1. Recall there are 8
More informationThe continue command goes back to the start of a loop and increments by one unit.
Break command: The break command will terminate a loop prematurely. n = 10; for i=1:n disp(i^2) if (i==5) break; 1 9 16 25 Continue command: The continue command goes back to the start of a loop and increments
More informationMATLAB: Introduction Part 1
MATLAB: Introduction Part 1 Bruno Abreu Calfa Last Update: August 9, 2011 Contents 1 MATLAB as a Calculator 1 2 MATLAB Classes 3 3 1-D Arrays (Vectors) 5 4 2-D Arrays (Matrices) 6 5 Element-wise Operations
More informationLecture 2 Introduction to MATLAB. Dr.Tony Cahill
Lecture 2 Introduction to MATLAB Dr.Tony Cahill The MATLAB Environment The Desktop Environment Command Window (Interactive commands) Command History Window Edit/Debug Window Workspace Browser Figure Windows
More informationMATLAB. MATLAB Review. MATLAB Basics: Variables. MATLAB Basics: Variables. MATLAB Basics: Subarrays. MATLAB Basics: Subarrays
MATLAB MATLAB Review Selim Aksoy Bilkent University Department of Computer Engineering saksoy@cs.bilkent.edu.tr MATLAB Basics Top-down Program Design, Relational and Logical Operators Branches and Loops
More informationLaboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information
Laboratory 2: Programming Basics and Variables Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information 3. Comment: a. name your program with extension.c b. use o option to specify
More informationFundamentals of Programming Session 8
Fundamentals of Programming Session 8 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2013 These slides have been created using Deitel s slides Sharif University of Technology Outlines
More information1) As a logical statement, is 1 considered true or false in MATLAB? Explain your answer.
ENGR 1181 Midterm 2+ Review Note: This practice material does not contain actual test questions or represent the format of the final. The first 20 questions should be completed WITHOUT using MATLAB. This
More informationAppendix A. Introduction to MATLAB. A.1 What Is MATLAB?
Appendix A Introduction to MATLAB A.1 What Is MATLAB? MATLAB is a technical computing environment developed by The Math- Works, Inc. for computation and data visualization. It is both an interactive system
More informationFormatting functions in C Language
Formatting functions in C Language Formatting means display data in different format, within given set of columns, show specified set of decimal and align the data to left or right along with zero fill
More informationLESSON QUESTIONS: Basic stats questions
LESSON QUESTIONS: Basic stats questions FOCUS QUESTION: How can I depict typical characteristics and central tendancies of data? Contents EXAMPLE 1: Load the data about New York contagious diseases EXAMPLE
More informationبسم اهلل الرمحن الرحيم
بسم اهلل الرمحن الرحيم Fundamentals of Programming C Session # 10 By: Saeed Haratian Fall 2015 Outlines Examples Using the for Statement switch Multiple-Selection Statement do while Repetition Statement
More informationMatlab Reports. Open Day Jan 8, 2013 Yair Altman. Yair Altman
Matlab Reports Open Day Jan 8, 2013 Yair Altman http://undocumentedmatlab.com/files/openday.zip Yair Altman www.undocumentedmatlab.com 1 Reporting in Matlab Output to Command Window / console Output to
More informationResult Point v3 User Manual, Revision Accelerated Technology Laboratories, Inc. All rights reserved.
User Manual Result Point v3 User Manual, Revision 2 Result Point User Manual Table of Contents WELCOME...1 LOGGING IN...1 RETRIEVING YOUR PASSWORD... 1 CHANGING YOUR PASSWORD... 1 CLIENT INTERFACE...2
More informationIntroduction to MATLAB
Introduction to MATLAB The Desktop When you start MATLAB, the desktop appears, containing tools (graphical user interfaces) for managing files, variables, and applications associated with MATLAB. The following
More informationIntermediate Programming, Spring 2017*
600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general
More informationFeatures of C. Portable Procedural / Modular Structured Language Statically typed Middle level language
1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC
More informationIntroduction to MATLAB LAB 1
Introduction to MATLAB LAB 1 1 Basics of MATLAB MATrix LABoratory A super-powerful graphing calculator Matrix based numeric computation Embedded Functions Also a programming language User defined functions
More informationUNIT ONE: The Worksheet. Workbook Window Excel Worksheet Fill handle Automatic fill Column widths Opening a file Saving a file
UNIT ONE: The Worksheet T o p i c s : Workbook Window Excel Worksheet Fill handle Automatic fill Column widths Opening a file Saving a file I. Start Excel: 1. Click the Start button in the lower-left corner
More informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
More informationExpressions, Input, Output and Data Type Conversions
L E S S O N S E T 3 Expressions, Input, Output and Data Type Conversions PURPOSE 1. To learn input and formatted output statements 2. To learn data type conversions (coercion and casting) 3. To work with
More informationCS 151 Review #3. // More than one variable can be defined // in a statement. Multiple variables are // separated by a comma.
REVIEW cout Statement The cout statement invokes an output stream, which is a sequence of characters to be displayed to the screen. cout
More information2 T. x + 2 T. , T( x, y = 0) = T 1
LAB 2: Conduction with Finite Difference Method Objective: The objective of this laboratory is to introduce the basic steps needed to numerically solve a steady state two-dimensional conduction problem
More informationCS 221 Lecture. Tuesday, 11 October 2011
CS 221 Lecture Tuesday, 11 October 2011 "Computers in the future may weigh no more than 1.5 tons." - Popular Mechanics, forecasting the relentless march of science, 1949. Today s Topics 1. Announcements
More informationC Concepts - I/O. Lecture 19 COP 3014 Fall November 29, 2017
C Concepts - I/O Lecture 19 COP 3014 Fall 2017 November 29, 2017 C vs. C++: Some important differences C has been around since around 1970 (or before) C++ was based on the C language While C is not actually
More informationSpring 2010 Instructor: Michele Merler.
Spring 2010 Instructor: Michele Merler http://www1.cs.columbia.edu/~mmerler/comsw3101-2.html Type from command line: matlab -nodisplay r command Tells MATLAB not to initialize the visual interface NOTE:
More informationLecture 3. Input and Output. Review from last week. Variable - place to store data in memory. identified by a name should be meaningful Has a type-
Lecture 3 Input and Output Review from last week Variable - place to store data in memory identified by a name should be meaningful Has a type- int double char bool Has a value may be garbage change value
More informationQUICK INTRODUCTION TO MATLAB PART I
QUICK INTRODUCTION TO MATLAB PART I Department of Mathematics University of Colorado at Colorado Springs General Remarks This worksheet is designed for use with MATLAB version 6.5 or later. Once you have
More informationMatlab- Command Window Operations, Scalars and Arrays
1 ME313 Homework #1 Matlab- Command Window Operations, Scalars and Arrays Last Updated August 17 2012. Assignment: Read and complete the suggested commands. After completing the exercise, copy the contents
More informationA Quick Tutorial on MATLAB. Zeeshan Ali
A Quick Tutorial on MATLAB Zeeshan Ali MATLAB MATLAB is a software package for doing numerical computation. It was originally designed for solving linear algebra type problems using matrices. It's name
More informationMATLAB TUTORIAL WORKSHEET
MATLAB TUTORIAL WORKSHEET What is MATLAB? Software package used for computation High-level programming language with easy to use interactive environment Access MATLAB at Tufts here: https://it.tufts.edu/sw-matlabstudent
More informationIntroduction to MATLAB
to MATLAB Spring 2019 to MATLAB Spring 2019 1 / 39 The Basics What is MATLAB? MATLAB Short for Matrix Laboratory matrix data structures are at the heart of programming in MATLAB We will consider arrays
More informationIntroduction to the C++ Programming Language
LESSON SET 2 Introduction to the C++ Programming Language OBJECTIVES FOR STUDENT Lesson 2A: 1. To learn the basic components of a C++ program 2. To gain a basic knowledge of how memory is used in programming
More informationHW 4 HINTS. 1. Chapter 6
HW 4 HINTS 1. Chapter 6 ***IMPORTANT GENERAL GUIDELINE*** When running commands inside loops and conditional statements, in general ALL output should be suppressed by placing a semicolon at the of the
More informationSECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing
SECTION 1: INTRODUCTION ENGR 112 Introduction to Engineering Computing 2 Course Overview What is Programming? 3 Programming The implementation of algorithms in a particular computer programming language
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting
More informationExcel Level Three. You can also go the Format, Column, Width menu to enter the new width of the column.
Introduction Excel Level Three This workshop shows you how to change column and rows, insert and delete columns and rows, how and what to print, and setting up to print your documents. Contents Introduction
More informationObjectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program
Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationPython Working with files. May 4, 2017
Python Working with files May 4, 2017 So far, everything we have done in Python was using in-memory operations. After closing the Python interpreter or after the script was done, all our input and output
More informationUsing Numbers, Formulas, and Functions
UNIT FOUR: Using Numbers, Formulas, and Functions T o p i c s : Using the Sort function Create a one-input data table Hide columns Resize columns Calculate with formulas Explore functions I. Using the
More information%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% MATLAB DEMO %% Basic Matlab commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% %% MATLAB DEMO 5-30-2013 %% Basic Matlab commands %%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%% %% diary command %%%%%%%%%%%%%%%%%%%%%%%%%% help diary DIARY Save text of MATLAB session. DIARY FILENAME causes
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
More informationLab 03 - x86-64: atoi
CSCI0330 Intro Computer Systems Doeppner Lab 03 - x86-64: atoi Due: October 1, 2017 at 4pm 1 Introduction 1 2 Assignment 1 2.1 Algorithm 2 3 Assembling and Testing 3 3.1 A Text Editor, Makefile, and gdb
More informationEcon Stata Tutorial I: Reading, Organizing and Describing Data. Sanjaya DeSilva
Econ 329 - Stata Tutorial I: Reading, Organizing and Describing Data Sanjaya DeSilva September 8, 2008 1 Basics When you open Stata, you will see four windows. 1. The Results window list all the commands
More informationCourse Title: C Programming Full Marks: Course no: CSC110 Pass Marks: Nature of course: Theory + Lab Credit hours: 3
Detailed Syllabus : Course Title: C Programming Full Marks: 60+20+20 Course no: CSC110 Pass Marks: 24+8+8 Nature of course: Theory + Lab Credit hours: 3 Course Description: This course covers the concepts
More informationHomework Set 1- Fundamentals
1 Homework Set 1- Fundamentals Topics if statements with ints if-else statements with Strings if statements with multiple boolean statements for loops and arrays while loops String ".equals()" method "=="
More informationFinding, Starting and Using Matlab
Variables and Arrays Finding, Starting and Using Matlab CSC March 6 &, 9 Array: A collection of data values organized into rows and columns, and known by a single name. arr(,) Row Row Row Row 4 Col Col
More informationC introduction: part 1
What is C? C is a compiled language that gives the programmer maximum control and efficiency 1. 1 https://computer.howstuffworks.com/c1.htm 2 / 26 3 / 26 Outline Basic file structure Main function Compilation
More informationMATLAB. Data and File Management
MATLAB Data and File Management File Details Storage of data in variables and arrays is temporary. For permanent retention of data files are used. All of us are familiar with files. We save our work (e.g.
More informationChapter 2 MATLAB Basics
EGR115 Introduction to Computing for Engineers MATLAB Basics from: S.J. Chapman, MATLAB Programming for Engineers, 5 th Ed. 2016 Cengage Learning Topics 2.1 Variables & Arrays 2.2 Creating & Initializing
More information