ENG Introduction to Engineering
|
|
- Jennifer McKenzie
- 5 years ago
- Views:
Transcription
1 GoBack
2 ENG Introduction to Engineering Lecture # 9 Files, Sounds, Images and Movies Koç University ENG Slide #1
3 File Handling MATLAB has two general ways of importing/exporting data from the disk: Loading/Saving workspace variables using load and save commands. More general file operations using fopen, fread, fwrite, fscanf, fprintf. In addition to these general file operations, there are specialized commands for reading, writing images, sounds, movies, which will be covered separately later. ENG Slide #2
4 Saving Work Space save command saves workspace variables on disk. Usage: save by itself saves all workspace variables to matlab.mat. save( filename ) saves all workspace variables to filename.mat. save( filename, var1, var2,...) saves only the specified workspace variables in filename.mat. save(..., format ) enables you to make use of other data formats available with the save function. ENG Slide #3
5 Saving Work Space ENG Slide #4
6 Loading Work Space load command loads workspace variables from disk Usage: load by itself loads all the variables from the MAT-file matlab.mat, if it exists, or returns an error if the file doesn t exist. load filename loads all the variables from the file specified by filename. filename is an unquoted string specifying a file name, and can also include a file extension and a full or partial pathname. If filename has no extension, load looks for a file named filename.mat and treats it as a binary MAT-file If filename has an extension other than.mat, load treats the file as ASCII data load filename X Y Z... loads just the specified variables X, Y, Z. load -ascii filename forces load to treat the file as an ASCII file, regardless of file extension ENG Slide #5
7 Loading Work Space ENG Slide #6
8 Loading Work Space ENG Slide #7
9 Loading Work Space ENG Slide #8
10 Low-level File Handling In addition to load, save commands for work space variables, MATLAB provides special functions for low-level file treatment: fopen fclose fread fwrite fscanf fprintf These commands provides lower level treatment of files. Their format is similar to C functions with the same names. ENG Slide #9
11 Opening files: fopen fopen is used to open a file for read/write operations. fopen can also be used to obtain information about an already open file. fid = fopen(filename) opens the file filename for read access. fid is a scalar MATLAB integer, called a file identifier. You use the fid as the first argument to other file input/output routines. If fopen cannot open the file, it returns -1. ENG Slide #10
12 Opening files: fopen fid = fopen(filename, mode) opens the file filename in the specified mode. Modes are defined as follows: ENG Slide #11
13 Reading from files: fread fread reads binary data from files A = fread(fid) reads data in binary format from the file specified by fid into matrix A. Open the file using fopen before calling fread. The fid argument is the integer file identifier obtained from the fopen operation. MATLAB reads the file from beginning to end, and then positions the file pointer at the end of the file ENG Slide #12
14 Reading from files: fread A = fread(fid, count) reads the number of elements specified by count. At the end of the fread, MATLAB sets the file pointer to the next byte to be read. A subsequent fread will begin at the location of the file pointer. A = fread(fid, count, precision) reads the file according to the data format specified by the string precision. precision argument commonly contains a data type specifier such as int or float, followed by an integer giving the size in bits. ENG Slide #13
15 Reading from files: fread Specifying Precision: Any of the strings in the following table, either the MATLAB version or their C or Fortran equivalent, can be used for precision ENG Slide #14
16 Reading from files: fread ENG Slide #15
17 Reading from files: fread Example 1 Continued ENG Slide #16
18 Reading from files: fread ENG Slide #17
19 Reading from files: fscanf fscanf is used to read formatted data from data files. A = fscanf(fid, format) reads all the data from the file specified by fid, converts it according to the specified format string, and returns it in matrix A. format string consists of ordinary characters and/or conversion specifications. Conversion specifications indicate the type of data to be matched and involve the character %, optional width fields, and conversion characters, organized as shown below ENG Slide #18
20 Reading from files: fscanf Conversion characters used in the format field; ENG Slide #19
21 Reading from files: fscanf [A,count] = fscanf(fid, format, size) reads the amount of data specified by size, converts it according to the specified format string, and returns it along with a count of elements successfully read. size is an argument that determines how much data is read. Valid options are: n: Read n elements into a column vector. inf: Read to the end of the file, resulting in a column vector containing the same number of elements as are in the file. [m,n]: Read enough elements to fill an m-by-n matrix, filling the matrix in column order. n can be specified as inf, but m cannot. ENG Slide #20
22 Reading from files: fscanf Example Suppose we have the following ASCII text file exp.txt We use the following MATLAB code to read data into MATLAB: ENG Slide #21
23 Writing to files: fwrite and fprintf fwrite is the dual of fread for writing to files, and its format is very similar: ENG Slide #22
24 Writing to files: fwrite and fprintf fprintf is the dual of fscanf for writing to files, and its format is very similar: ENG Slide #23
25 Standard File Formats The low-level file handling functions are intended to be used for file formats you specify. For the standard file formats for images, sound, movies, datasheets, MATLAB provides easy to use functions, so you don t need to know the format of these files and bother using fopen, fscanf etc. But what are the file formats for which MATLAB provides functions? You can use fileformats command to display them! ENG Slide #24
26 MATLAB Supported File Formats ENG Slide #25
27 MATLAB Supported File Formats ENG Slide #26
28 Sound Files Wave files are one of the most common formats of storing sound files. These files by convention have extension.wav Wave files keep the sound files at a higher quality than MP3 format but they require more disk space! MATLAB provide wavread function for reading wave files: Here Fs: The number of samples taken from the sound in a second. bits: The number of bits used for each sound sample. ENG Slide #27
29 Sound File Example To illustrate the use of this function, lets look at the following example, where we read a wave file containing 9 second piece of Diana Krall s song "Temptation": ENG Slide #28
30 Sound File Example Resulting plot for the 9-second piece of the the song is shown below: Time (seconds) Now to listen to this song-piece we use another MATLAB command sound: sound(y,fs) ENG Slide #29
31 Writing Sound Files Suppose you somehow modified the song piece in MATLAB (by doing some Signal Processing operations!). And you want to save it in the wave file format so that your friends can listen to it. MATLAB has a special treat: You can write it in the wave file format by using MATLAB s wavwrite function: wavwrite(y, filename ) wavwrite(y,fs, filename ) wavwrite(y,fs,n, filename ) ENG Slide #30
32 Image File Formats There are many file formats for storing images. To name some: JPEG, TIFF, PNG etc. MATLAB provides imread function that allows you to read most of the available formats. The most common syntax for imread is [X,map] = imread(filename,fmt) Here X is a matrix containing the image. map is the colormap information related to image. ENG Slide #31
33 Image File Example Lets read an image using imread command [X,map]=imread( peppers.png ); peppers.png is an image file that comes with MATLAB. Lets display the image using imshow imshow(x,map} The result is.. ENG Slide #32
34 Writing Image Files If you create your own image file, or if you modify an existing image (through some Image Processing algorithms) you can write the resulting image to a file using imwrite command of MATLAB: imwrite(a,filename,fmt) By choosing the fmt appropriately, you can create an image file of any supported type. ENG Slide #33
35 Movies You can read AVI type video files to MATLAB using aviread command, e.g., mov=aviread( bassguitarmovie ); You can display the load movie using movie command: movie(mov) The screen shot of the resulting movie is shown below: ENG Slide #34
Using 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 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 informationCSE 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 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 informationFö 6: Filhantering. DN1212 Numeriska metoder och grundläggande programmering. Pawel Herman. KTH/CB
Fö 6: Filhantering DN1212 Numeriska metoder och grundläggande programmering paherman@kth.se KTH/CB 22 februari Pawel 2013Herman Lecture outline Recapitulation of what we already know about I/O Matlab format
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 information12-Reading Data text: Chapter ECEGR 101 Engineering Problem Solving with Matlab Professor Henry Louie
12-Reading Data text: Chapter 4.4-4.5 ECEGR 101 Engineering Problem Solving with Matlab Professor Henry Louie Overview Reading Data from.txt Reading Data from.xls and.csv Reading Data from.mat User Interface
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 informationIntroduction to file management
1 Introduction to file management Some application require input to be taken from a file and output is required to be stored in a file. The C language provides the facility of file input-output operations.
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 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 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 informationWorking with Excel Files. a = round(rand(5,3)*100) xlswrite('rand.xlsx',a) b = xlsread('rand.xlsx')
File I/O Working with Excel Files a = round(rand(5,3)*100) xlswrite('rand.xlsx',a) b = xlsread('rand.xlsx') Excel files with mixed content >> [nums, txt, raw] = xlsread('texttest.xls') nums = 123 333 432
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 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 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 informationMatlab. Carlo Tomasi. Since images are matrices of numbers, many vision algorithms are naturally implemented
Matlab Carlo Tomasi MATLAB is a simple and useful high-level language for matrix manipulation. It is often convenient to use MATLAB even for programs for which this language is not the ideal choice in
More informationC File System File Functions EXPERIMENT 1.2
C File System File Functions EXPERIMENT 1.2 Propose of the experiment Continue from previous experiment to be familiar with CCS environment Write a C language file input / output (CIO) program to read
More informationDATA STRUCTURES USING C
DATA STRUCTURES USING C File Handling in C Goals By the end of this unit you should understand how to open a file to write to it. how to open a file to read from it. how to open a file to append data to
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 informationHow to inport the data. Part 1: How to use image data
How to inport the data Part 1: How to use image data Example 1 >> kou=imread( kou.jpg','jpg'); Or File inport date kou.jpg kou(:,:,1) : Red kou(:,:,2) : Green kou(:,:,3) : Blue >> whos kou Name Size Bytes
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 informationComputer System and programming in C
File Handling in C What is a File? A file is a collection of related data that a computers treats as a single unit. Computers store files to secondary storage so that the contents of files remain intact
More informationDescription Syntax Remarks and examples Conformability Diagnostics Also see
Title stata.com bufio( ) Buffered (binary) I/O Description Syntax Remarks and examples Conformability Diagnostics Also see Description These functions manipulate buffers (string scalars) containing binary
More informationMATLAB SON Library. Malcolm Lidierth King's College London Updated October 2005 (version 2.0)
MATLAB SON Library Malcolm Lidierth King's College London Updated October 2005 (version 2.0) This pack now contains two libraries: SON2 is a backwards-compatible update to the previous library. It provides
More informationBIL 104E Introduction to Scientific and Engineering Computing. Lecture 12
BIL 104E Introduction to Scientific and Engineering Computing Lecture 12 Files v.s. Streams In C, a file can refer to a disk file, a terminal, a printer, or a tape drive. In other words, a file represents
More informationSTAT 391 Handout 1 Making Plots with Matlab Mar 26, 2006
STAT 39 Handout Making Plots with Matlab Mar 26, 26 c Marina Meilă & Lei Xu mmp@cs.washington.edu This is intended to help you mainly with the graphics in the homework. Matlab is a matrix oriented mathematics
More informationFiles and Streams Opening and Closing a File Reading/Writing Text Reading/Writing Raw Data Random Access Files. C File Processing CS 2060
CS 2060 Files and Streams Files are used for long-term storage of data (on a hard drive rather than in memory). Files and Streams Files are used for long-term storage of data (on a hard drive rather than
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 informationIntroduction to Programming in C Department of Computer Science and Engineering. Lecture No. #47. File Handling
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #47 File Handling In this video, we will look at a few basic things about file handling in C. This is a vast
More informationStandard File Pointers
1 Programming in C Standard File Pointers Assigned to console unless redirected Standard input = stdin Used by scan function Can be redirected: cmd < input-file Standard output = stdout Used by printf
More informationUNIT IV-2. The I/O library functions can be classified into two broad categories:
UNIT IV-2 6.0 INTRODUCTION Reading, processing and writing of data are the three essential functions of a computer program. Most programs take some data as input and display the processed data, often known
More informationStandard C Library Functions
Demo lecture slides Although I will not usually give slides for demo lectures, the first two demo lectures involve practice with things which you should really know from G51PRG Since I covered much of
More informationAccessing Files in C. Professor Hugh C. Lauer CS-2303, System Programming Concepts
Accessing Files in C Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by Walter
More informationCSI 402 Systems Programming LECTURE 4 FILES AND FILE OPERATIONS
CSI 402 Systems Programming LECTURE 4 FILES AND FILE OPERATIONS A mini Quiz 2 Consider the following struct definition struct name{ int a; float b; }; Then somewhere in main() struct name *ptr,p; ptr=&p;
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 informationIntensive Course on Image Processing Matlab project
Intensive Course on Image Processing Matlab project All the project will be done using Matlab software. First run the following command : then source /tsi/tp/bin/tp-athens.sh matlab and in the matlab command
More informationMatlab Primer. Lecture 02a Optical Sciences 330 Physical Optics II William J. Dallas January 12, 2005
Matlab Primer Lecture 02a Optical Sciences 330 Physical Optics II William J. Dallas January 12, 2005 Introduction The title MATLAB stands for Matrix Laboratory. This software package (from The Math Works,
More informationTHE BARE ESSENTIALS OF MATLAB
WHAT IS MATLAB? Matlab was originally developed to be a matrix laboratory, and is used as a powerful software package for interactive analysis and visualization via numerical computations. It is oriented
More informationLecture 12 CSE July Today we ll cover the things that you still don t know that you need to know in order to do the assignment.
Lecture 12 CSE 110 20 July 1992 Today we ll cover the things that you still don t know that you need to know in order to do the assignment. 1 The NULL Pointer For each pointer type, there is one special
More informationMatlab? Chapter 3-4 Matlab and IPT Basics. Working Environment. Matlab Demo. Array. Data Type. MATLAB Desktop:
Matlab? Lecture Slides ME 4060 Machine Vision and Vision-based Control Chapter 3-4 Matlab and IPT Basics By Dr. Debao Zhou 1 MATric LABoratory data analysis, prototype and visualization Matrix operation
More informationUNIX input and output
UNIX input and output Disk files In UNIX a disk file is a finite sequence of bytes, usually stored on some nonvolatile medium. Disk files have names, which are called paths. We won t discuss file naming
More informationPhysical Files and Logical Files. Opening Files. Chap 2. Fundamental File Processing Operations. File Structures. Physical file.
File Structures Physical Files and Logical Files Chap 2. Fundamental File Processing Operations Things you have to learn Physical files and logical files File processing operations: create, open, close,
More informationQuick review of previous lecture Ch6 Structure Ch7 I/O. EECS2031 Software Tools. C - Structures, Unions, Enums & Typedef (K&R Ch.
1 Quick review of previous lecture Ch6 Structure Ch7 I/O EECS2031 Software Tools C - Structures, Unions, Enums & Typedef (K&R Ch.6) Structures Basics: Declaration and assignment Structures and functions
More informationLow-Level File I/O. 1. Open a file. 2. Read or write data into the file. 3. Close the file. Zheng-Liang Lu 1 / 14
Low-Level File I/O Low-level file I/O functions allow the most control over reading or writing data to a file. However, these functions require that you specify more detailed information about your file
More informationCSci 4061 Introduction to Operating Systems. Input/Output: High-level
CSci 4061 Introduction to Operating Systems Input/Output: High-level I/O Topics First, cover high-level I/O Next, talk about low-level device I/O I/O not part of the C language! High-level I/O Hide device
More informationCSI 402 Lecture 2 (More on Files) 2 1 / 20
CSI 402 Lecture 2 (More on Files) 2 1 / 20 Files A Quick Review Type for file variables: FILE * File operations use functions from stdio.h. Functions fopen and fclose for opening and closing files. Functions
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 informationMode Meaning r Opens the file for reading. If the file doesn't exist, fopen() returns NULL.
Files Files enable permanent storage of information C performs all input and output, including disk files, by means of streams Stream oriented data files are divided into two categories Formatted data
More informationIntroduction to Matlab
Introduction to Matlab 1 Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display Facilities Flow Control Using of M-File Writing User
More informationTHE C STANDARD LIBRARY & MAKING YOUR OWN LIBRARY. ISA 563: Fundamentals of Systems Programming
THE C STANDARD LIBRARY & MAKING YOUR OWN LIBRARY ISA 563: Fundamentals of Systems Programming Announcements Homework 2 posted Homework 1 due in two weeks Typo on HW1 (definition of Fib. Sequence incorrect)
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 informationComputational Methods of Scientific Programming
12.010 Computational Methods of Scientific Programming Lecturers Thomas A Herring, Jim Elliot, Chris Hill, Summary of Today s class We will look at Matlab: History Getting help Variable definitions and
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 informationThe following is a table that shows the storage requirements of each data type and format:
Name: Sayed Mehdi Sajjadi Mohammadabadi CS5320 A1 1. I worked with imshow in MATLAB. It can be used with many parameters. It can handle many file types automatically. So, I don t need to be worried about
More informationCSC209H Lecture 3. Dan Zingaro. January 21, 2015
CSC209H Lecture 3 Dan Zingaro January 21, 2015 Streams (King 22.1) Stream: source of input or destination for output We access a stream through a file pointer (FILE *) Three streams are available without
More informationENG120. Misc. Topics
ENG120 Misc. Topics Topics Files in C Using Command-Line Arguments Typecasting Working with Multiple source files Conditional Operator 2 Files and Streams C views each file as a sequence of bytes File
More information25.2 Opening and Closing a File
Lecture 32 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lecture 32: Dynamically Allocated Arrays 26-Nov-2018 Location: Chemistry 125 Time: 12:35 13:25 Instructor:
More informationC Syntax Arrays and Loops Math Strings Structures Pointers File I/O. Final Review CS Prof. Jonathan Ventura. Prof. Jonathan Ventura Final Review
CS 2060 Variables Variables are statically typed. Variables must be defined before they are used. You only specify the type name when you define the variable. int a, b, c; float d, e, f; char letter; //
More informationSchool Of Electrical, Computer & Telecommunications Engineering UOW. Training Lab. Introduction to MATLAB. Version: 1.1
School Of Electrical, Computer & Telecommunications Engineering UOW Training Lab Introduction to MATLAB Version: 1.1 This publication is copyright. The contents of this publication are strictly for the
More informationProgram Design (II): Quiz2 May 18, 2009 Part1. True/False Questions (30pts) Part2. Multiple Choice Questions (40pts)
Class: No. Name: Part1. True/False Questions (30pts) 1. Function fscanf cannot be used to read data from the standard input. ANS: False. Function fscanf can be used to read from the standard input by including
More informationC Basics And Concepts Input And Output
C Basics And Concepts Input And Output Report Working group scientific computing Department of informatics Faculty of mathematics, informatics and natural sciences University of Hamburg Written by: Marcus
More informationfopen() fclose() fgetc() fputc() fread() fwrite()
The ability to read data from and write data to files is the primary means of storing persistent data, data that does not disappear when your program stops running. The abstraction of files that C provides
More informationPROGRAMMAZIONE I A.A. 2017/2018
PROGRAMMAZIONE I A.A. 2017/2018 INPUT/OUTPUT INPUT AND OUTPUT Programs must be able to write data to files or to physical output devices such as displays or printers, and to read in data from files or
More informationM.CS201 Programming language
Power Engineering School M.CS201 Programming language Lecture 16 Lecturer: Prof. Dr. T.Uranchimeg Agenda Opening a File Errors with open files Writing and Reading File Data Formatted File Input Direct
More informationMore on Images and Matlab
More on Images and Matlab Prof. Eric Miller elmiller@ece.tufts.edu Fall 2007 EN 74-ECE Image Processing Lecture 3-1 Matlab Data Types Different means of representing numbers depending on what you want
More informationCOMP1917: 15 File IO
COMP1917: 15 File IO Sim Mautner s.mautner@unsw.edu.au October 9, 2016 Sim Mautner (UNSW) COMP1917: 15 File IO October 9, 2016 1 / 8 Purpose Read/write external files from within an application. Previously,
More informationCSCE C. Lab 10 - File I/O. Dr. Chris Bourke
CSCE 155 - C Lab 10 - File I/O Dr. Chris Bourke Prior to Lab Before attending this lab: 1. Read and familiarize yourself with this handout. 2. Review the following free textbook resources: http://en.wikibooks.org/wiki/c_programming/file_io
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 informationLecture 8: Structs & File I/O
....... \ \ \ / / / / \ \ \ \ / \ / \ \ \ V /,----' / ^ \ \.--..--. / ^ \ `--- ----` / ^ \. ` > < / /_\ \. ` / /_\ \ / /_\ \ `--' \ /. \ `----. / \ \ '--' '--' / \ / \ \ / \ / / \ \ (_ ) \ (_ ) / / \ \
More informationSECTION 2: PROGRAMMING WITH MATLAB. MAE 4020/5020 Numerical Methods with MATLAB
SECTION 2: PROGRAMMING WITH MATLAB MAE 4020/5020 Numerical Methods with MATLAB 2 Functions and M Files M Files 3 Script file so called due to.m filename extension Contains a series of MATLAB commands 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 informationMATLAB & Practical Applications on Climate Variability Studies tutorial
MATLAB & Practical Applications on Climate Variability Studies tutorial B.Aires, 20-24/02/06 Centro de Investigaciones del Mar y la Atmosfera & Department of Atmospheric and Oceanic Sciences (UBA) E.Scoccimarro,
More informationInput/Output: Advanced Concepts
Input/Output: Advanced Concepts CSE 130: Introduction to Programming in C Stony Brook University Related reading: Kelley/Pohl 1.9, 11.1 11.7 Output Formatting Review Recall that printf() employs a control
More informationSystem Software Experiment 1 Lecture 7
System Software Experiment 1 Lecture 7 spring 2018 Jinkyu Jeong ( jinkyu@skku.edu) Computer Systems Laboratory Sungyunkwan University http://csl.skku.edu SSE3032: System Software Experiment 1, Spring 2018
More informationCSCI 171 Chapter Outlines
Contents CSCI 171 Chapter 1 Overview... 2 CSCI 171 Chapter 2 Programming Components... 3 CSCI 171 Chapter 3 (Sections 1 4) Selection Structures... 5 CSCI 171 Chapter 3 (Sections 5 & 6) Iteration Structures
More informationCSE/Math 485 Matlab Tutorial and Demo
CSE/Math 485 Matlab Tutorial and Demo Some Tutorial Information on MATLAB Matrices are the main data element. They can be introduced in the following four ways. 1. As an explicit list of elements. 2. Generated
More informationOrganization of a file
File Handling 1 Storage seen so far All variables stored in memory Problem: the contents of memory are wiped out when the computer is powered off Example: Consider keeping students records 100 students
More information8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics
Computer Organization Computer Basics TOPICS Computer Organization Data Representation Program Execution Computer Languages 1 2 Architecture Computer Organization n central-processing unit n performs the
More informationCAAM 420 Notes Chapter 2: The C Programming Language
CAAM 420 Notes Chapter 2: The C Programming Language W. Symes and T. Warburton October 2, 2013 22 Stack Overflow Just for warmup, here is a remarkable memory bust: 1 / Author : WWS 3 Purpose : i l l u
More informationCSCI S-Q Lecture #12 7/29/98 Data Structures and I/O
CSCI S-Q Lecture #12 7/29/98 Data Structures and I/O Introduction The WRITE and READ ADT Operations Case Studies: Arrays Strings Binary Trees Binary Search Trees Unordered Search Trees Page 1 Introduction
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 informationV.S.B ENGINEERING COLLEGE DEPARTMENT OF INFORMATION TECHNOLOGY I IT-II Semester. Sl.No Subject Name Page No. 1 Programming & Data Structures-I 2
V.S.B ENGINEERING COLLEGE DEPARTMENT OF INFORMATION TECHNOLOGY I IT-II Semester Sl.No Subject Name Page No. 1 Programming & Data Structures-I 2 CS6202 - PROGRAMMING & DATA STRUCTURES UNIT I Part - A 1.
More informationCSI 402 Lecture 2 Working with Files (Text and Binary)
CSI 402 Lecture 2 Working with Files (Text and Binary) 1 / 30 AQuickReviewofStandardI/O Recall that #include allows use of printf and scanf functions Example: int i; scanf("%d", &i); printf("value
More informationEngineering program development 7. Edited by Péter Vass
Engineering program development 7 Edited by Péter Vass Functions Function is a separate computational unit which has its own name (identifier). The objective of a function is solving a well-defined problem.
More informationChapter 9. Above: An early computer input/output device on the IBM 7030 (STRETCH)
Chapter 9 Above: An early computer input/output device on the IBM 7030 (STRETCH) http://computer-history.info/page4.dir/pages/ibm.7030.stretch.dir/ Io One of the moon s of Jupiter (A Galilean satellite)
More informationFile IO and command line input CSE 2451
File IO and command line input CSE 2451 File functions Open/Close files fopen() open a stream for a file fclose() closes a stream One character at a time: fgetc() similar to getchar() fputc() similar to
More informationMatlab Input/Output. Goal of this section Learn user-controlled Input Output Read/write data files (optional) Input/output 5-
Matlab Input/Output Goal of this section Learn user-controlled Input Output Read/write data files (optional) 85-232 Input/output 5-1 Input: initialization >> a=[-1 0 0 ; 1 1 0] >> b=[1, 2, 3; 2:4] >> b=[1,
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 informationC-Refresher: Session 10 Disk IO
C-Refresher: Session 10 Disk IO Arif Butt Summer 2017 I am Thankful to my student Muhammad Zubair bcsf14m029@pucit.edu.pk for preparation of these slides in accordance with my video lectures at http://www.arifbutt.me/category/c-behind-the-curtain/
More informationTEXT FILE I/O. printf("this data will be written to the screen.\n"); printf("x = %d, y = %f\n", x, y);
Text File I/O TEXT FILE I/O Basic text file I/O is only slightly more difficult than the I/O done to date. Every I/O function seen so far has a sister function that will read/write to a file on disk. The
More informationC programming basics T3-1 -
C programming basics T3-1 - Outline 1. Introduction 2. Basic concepts 3. Functions 4. Data types 5. Control structures 6. Arrays and pointers 7. File management T3-2 - 3.1: Introduction T3-3 - Review of
More informationBinghamton University. CS-220 Spring Includes & Streams
Includes & Streams 1 C Pre-Processor C Program Pre-Processor Pre-processed C Program Header Files Header Files 2 #include Two flavors: #include Replace this line with the contents of file abc.h
More informationFile I/O Lesson Outline
Outline 1. Outline 2. File I/O Using Redirection #1 3. File I/O Using Redirection #2 4. Direct File I/O #1 5. Direct File I/O #2 6. File I/O Mode 7. FILE Pointer 8. Reading from a File 9. Writing to a
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 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 informationFile (1A) Young Won Lim 11/25/16
File (1A) Copyright (c) 2010-2016 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version
More informationInput / Output Functions
CSE 2421: Systems I Low-Level Programming and Computer Organization Input / Output Functions Presentation G Read/Study: Reek Chapter 15 Gojko Babić 10-03-2018 Input and Output Functions The stdio.h contain
More informationApplication Note: MatLab data processing for Motion Capture. Zhichao Lu Team 8 Documents Prep. Date: April 5, 2013
Application Note: MatLab data processing for Motion Capture Zhichao Lu Team 8 Documents Prep. Date: April 5, 2013 Executive Summary This application note is a tutorial that guides users through how to
More informationLecture 7: file I/O, more Unix
CIS 330: / / / / (_) / / / / _/_/ / / / / / \/ / /_/ / `/ \/ / / / _/_// / / / / /_ / /_/ / / / / /> < / /_/ / / / / /_/ / / / /_/ / / / / / \ /_/ /_/_/_/ _ \,_/_/ /_/\,_/ \ /_/ \ //_/ /_/ Lecture 7: file
More information