Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 13 Strings and File I/O  Read Bishop, Chapter 9.  Lab #13 and Homework #13 due next week.

Slides:



Advertisements
Similar presentations
Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI A. File Formats At their lowest level, all files written to your computers hard drive are a series.
Advertisements

Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 2 Virtual Instruments Read Bishop, Chapter 2. Lab #2 and Homework #2 due next week. Quiz #1 next week.
Based on LabVIEW 2011 Student Edition
Computer Science & Engineering 2111 Text Functions 1CSE 2111 Lecture-Text Functions.
EET 1131 Unit 7 Arithmetic Operations and Circuits
The Binary Numbering Systems
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 5 Loops  Read Bishop, Sections 5.1 and 5.2.  Lab #5 and Homework #5 due next week.  Exam #1 next.
Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts
Access - Project 1 l What Is a Database? –A Collection of Data –Organized in a manner to allow: »Access »Retrieval »Use of That Data.
1 Computers and Representations Ascii vs. Binary Files Over the last few million years, Earth has experienced numerous ice ages when vast regions of the.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L07 (Chapter 18) Binary I/O.
Chapter 7 Data Management. Agenda Database concept Import data Input and edit data Sort data Function Filter data Create range name Calculate subtotal.
1 The Information School of the University of Washington Nov 6fit more-digital © 2006 University of Washington Digital Information INFO/CSE 100,
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
1 Lesson 5 Clusters TOPICS Introduction to Clusters Cluster Functions Error Clusters.
A.How to create string controls and indicators B.Some string functions C.How to perform file input and output operations D.How to format text files for.
Guide To UNIX Using Linux Third Edition
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 12 Data Acquisition  Read Bishop, Chapter 8.  Lab #12 and Homework #12 due next week.
Entering Data in Excel. Entering numbers, text, a date, or a time n 1Click the cell where you want to enter data. n 2Type the data and press ENTER or.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 11 Charts and Graphs  Read Bishop, Chapter 7.  Lab #11 and Homework #11 due next week.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 4 SubVIs  Read Bishop, Chapter 4.  Lab #4 and Homework #4 due next week.
Homework Reading –Finish K&R Chapter 1 (if not done yet) –Start K&R Chapter 2 for next time. Programming Assignments –DON’T USE and string library functions,
Using Linux Text Editors. Use Non-Graphical Linux Text Editors Graphical Text Editor.
Course contents 1.Labview basics – virtual instruments, data flow, palettes 2.Structures – for, while, case,... – editing techniques 3.Controls&Indicators.
Homework Reading Programming Assignments
Coding for Excel Analysis Optional Exercise Map Your Hazards! Module, Unit 2 Map Your Hazards! Combining Natural Hazards with Societal Issues.
Topics Introduction Hardware and Software How Computers Store Data
1 Lab Session-III CSIT-120 Fall 2000 Revising Previous session Data input and output While loop Exercise Limits and Bounds Session III-B (starts on slide.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
Introduction to Unix (CA263) File Processing. Guide to UNIX Using Linux, Third Edition 2 Objectives Explain UNIX and Linux file processing Use basic file.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (3): MATLAB Environment (Chapter 1)
 A database is a collection of data that is organized so that its contents can easily be accessed, managed, and updated. What is Database?
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
STREAMS AND FILES OVERVIEW.  Many programs are "data processing" applications  Read the input data  Perform sequence of operations on this data  Write.
HOW COMPUTERS MANIPULATE DATA Chapter 1 Coming up: Analog vs. Digital.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 3 Editing and Debugging VIs  Read Bishop, Chapter 3.  Lab #3 and Homework #3 due next week.  Quiz.
Copyrighted material John Tullis 10/17/2015 page 1 04/15/00 XML Part 3 John Tullis DePaul Instructor
SE-1020 Dr. Mark L. Hornick 1 File Input and Output.
1 Week 12 l Overview of Streams and File I/O l Text File I/O Streams and File I/O.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 24 The String Section.
An Introduction to Programming with C++ Sixth Edition Chapter 14 Sequential Access Files.
Data Representation, Number Systems and Base Conversions
Chapter Three The UNIX Editors.
CS 111 – Sept. 1 Intro to data representation Binary numbers –Convert binary  decimal –Convert decimal  binary Text –ASCII and Unicode Commitment: –For.
Programming Fundamentals. Summary of previous lectures Programming Language Phases of C++ Environment Variables and Data Types.
An Introduction to Programming with C++ Sixth Edition Chapter 13 Strings.
1 Project 3 String Methods. Project 3: String Methods Write a program to do the following string manipulations: Prompt the user to enter a phrase and.
1 CSC103: Introduction to Computer and Programming Lecture No 28.
1 Week # 4 Introduction to PDM PDM is a workbench environment that lets programmers and system operators navigate the three levels of the AS/400’s object-based.
A FIRST BOOK OF C++ CHAPTER 14 THE STRING CLASS AND EXCEPTION HANDLING.
Winter 2016CISC101 - Prof. McLeod1 CISC101 Reminders Quiz 3 this week – last section on Friday. Assignment 4 is posted. Data mining: –Designing functions.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Programmable Logic Controller
Binary Representation in Text
Binary Representation in Text
Lesson 5-Exploring Utilities
EET 2259 Unit 13 Strings and File I/O
Fundamentals of Python: First Programs
Topics Introduction Hardware and Software How Computers Store Data
CHAPTER 5 JAVA FILE INPUT/OUTPUT
Chapter 17 Binary I/O Dr. Clincy - Lecture.
Topics Introduction Hardware and Software How Computers Store Data
Chapter Four UNIX File Processing.
Homework Reading Programming Assignments Finish K&R Chapter 1
EET 2259 Unit 13 Strings and File I/O
EET 2259 Unit 2 Virtual Instruments
Presentation transcript:

Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 13 Strings and File I/O  Read Bishop, Chapter 9.  Lab #13 and Homework #13 due next week.

Floyd, Digital Fundamentals, 10 th ed Strings  A string is a sequence of characters.  Characters include letters, numerals, punctuation marks, spaces, and certain non-displayable characters such as linefeed and tab. (Bishop, p. 400)

Floyd, Digital Fundamentals, 10 th ed Uses of Strings  Strings have several uses in LabVIEW: Displaying text messages to the user or allowing the user to enter text. Sending commands over cables to instruments to control those instruments. Storing data in a file on a disk. (Bishop, p. 400)

Floyd, Digital Fundamentals, 10 th ed String Display Modes  String controls and string indicators can be configured to display their contents in any of the following modes: Normal Display (the default) \ Codes Display Password Display Hex Display  Hex Display shows the ASCII codes for the characters.ASCII codes

Floyd, Digital Fundamentals, 10 th ed String Functions  You’re already familiar with some of the functions, constants, and VIs on the Programming > String palette.

Floyd, Digital Fundamentals, 10 th ed String Subset Function  The function named String Subset lets you pull out a piece of a string, starting at any point in the string that you want.

Floyd, Digital Fundamentals, 10 th ed Numbers versus Numeric Strings  To understand many of the other functions and VIs on this palette, answer the following question: What’s the difference between the two indicators shown below?

Floyd, Digital Fundamentals, 10 th ed Numbers Functions versus String Functions  Depending on what you’re trying to do with numeric information, you may want to have that information represented as numeric data or as string data.  Examples: What if you want to…. Multiply it by 2? Find out how many digits it contains? Round it to the nearest integer? See whether it contains a decimal point?

Floyd, Digital Fundamentals, 10 th ed Converting Between Numbers and Numeric Strings  The functions on the Programming > String >String/Number Conversion palette let you convert between numeric data and string data.  Functions in the 1 st row convert numbers to string.  Functions in the 2 nd row convert strings to numbers.

Floyd, Digital Fundamentals, 10 th ed Scan From String and Format Into String  You can use two “super-functions” to do the work of all the other conversion functions: Use Scan From String to convert strings to numbers. Use Format Into String to convert numbers to strings.

Floyd, Digital Fundamentals, 10 th ed format string Input  These two functions have a format string input that lets you say exactly how the number is formatted. The example below, which uses the Format Into String function, will format the number into a string containing at least 6 characters, with 3 digits following the decimal point.

Floyd, Digital Fundamentals, 10 th ed Other String Functions  LabVIEW provides other useful string functions not discussed in the textbook, including: String Length Concatenate Strings String Subset To Upper Case & To Lower Case Search & Replace String

Floyd, Digital Fundamentals, 10 th ed File I/O  Functions and VIs on the Programming > File I/O palette let you: Read data from files on disk Write data to files on disk Move, copy, rename, and delete files (and directories) on disk And more …

Floyd, Digital Fundamentals, 10 th ed Which Kind of File?  This is a large and complex topic, because LabVIEW can read from or write to many different kinds of files.  These file types can be grouped into two broad categories: Text files, whose contents are in ASCII format. You can open and read these files in a text editor or word processor. Binary files, which look like gibberish if you open them in a text editor or word processor.

Floyd, Digital Fundamentals, 10 th ed Choosing Text File versus Binary File  If you have to save LabVIEW data to a file, how do you decide which kind of file? It’s a trade-off.  The big advantage of text files is portability: you can open them in other programs.  The big advantage of binary files is efficiency: they take up less disk space and can be processed more quickly than text files.

Floyd, Digital Fundamentals, 10 th ed Which Kind of Text File?  LabVIEW can work with the following specific kinds of text files: Generic text files, which can contain any text Spreadsheet files, which contain numbers in rows and columns LabVIEW Measurement (.lvm) files Configuration (.ini) files XML files

Floyd, Digital Fundamentals, 10 th ed Which Kind of Binary File?  LabVIEW can work with the following specific kinds of binary files: Generic binary files. LabVIEW TDMS (Technical Data Management Streaming) files LabVIEW Datalog Files ZIP files

Floyd, Digital Fundamentals, 10 th ed High-Level versus Intermediate- Level  The items on the File I/O palette can be categorized as high-level or intermediate- level. The high-level VIs are easier to use. They call the intermediate-level functions. The intermediate-level functions give you more control, but require more work on your part. (Bishop, p. 412)

Floyd, Digital Fundamentals, 10 th ed Three Steps in File I/O  Most file I/O operations involve three steps: 1. Open an existing file or create a new file. 2. Read data from or write data to the file. 3. Close the file.  The high-level VIs combine all three of these steps into a single VI.  On the other hand, with intermediate-level functions, you must do each step separately, as on the next slide. (Bishop, pp )

Floyd, Digital Fundamentals, 10 th ed A Simple Text-File Example  Writing to a text file:  Reading it back from the file:

Floyd, Digital Fundamentals, 10 th ed A Simple Binary-File Example  Writing to a binary file:  Reading it back from the file: