1 / 21

A. File Formats

A. File Formats. At their lowest level, all files written to your computer’s hard drive are a series of bits. A. File Formats. A. Understanding File I/O. File I/O writes to or reads from a file A typical file I/O operation involves the following process:. Open/ Create/ Replace File. Read

yagil
Download Presentation

A. File Formats

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A. File Formats • At their lowest level, all files written to your computer’s hard drive are a series of bits

  2. A. File Formats

  3. A. Understanding File I/O • File I/O writes to or reads from a file • A typical file I/O operation involves the following process: Open/Create/Replace File Read and/orWrite to File Close File Check for Errors

  4. A. Understanding File I/O – File Formats LabVIEW can use or create the following file formats: • Binary—Underlying file format of all other file formats • ASCII—Specific type of binary file that is a standard used by most programs • TDMS—Type of binary file created for NI products consisting of two separate files: a binary file and a binary index file

  5. A. Understanding File I/O – File Formats • Use text files in the following situations: • You want to access the file from another application • Disk space and file I/O speed are not crucial • You must not perform random access reads or writes • Numeric precision is not important

  6. B. Understanding High-level File I/O • High-level VIs • Perform all three steps (open, read/write, close) for common file I/O operations • Might not be as efficient as the functions configured or designed for individual operations • Low-level VIs • Individual VI for each step • If you are writing to a file in a loop, use low-level file I/O functions

  7. B. Understanding High-Level File I/O Write to Spreadsheet File • Converts an array of double-precision numbers to a text string and writes the string to an ASCII file Read From Spreadsheet File • Reads a specified number of lines or rows from a numeric text file and outputs a 2D array of double-precision numbers Write to/Read from Measurement File • Express VIs that write data to or read data from an LVM or TDMS file format

  8. B. Binary Files—Sequential/Random Access • Two methods of accessing data: • Sequential Access—Read each item in order, starting at the beginning of a file • Random Access—Access data at an arbitrary point within the file

  9. B. Binary Files—Sequential Access • To sequentially access all of the data in a file, you can call the Get File Size function and use the result to calculate the number of items in the file, based upon the size of each item and the layout of the file • You can then wire the number of items to the count terminal of the Read from Binary File function

  10. B. Binary Files—Random Access • Use the Set File Position function to set the read offset to the point in the file you want to begin reading • The offset is in bytes; therefore, you must calculate the offset based upon the layout of the file

  11. C. TDMS Files • TDMS • Technical Data Management Streaming • Use TDMS files for the following purposes: • To store test or measurement data • To create a structure for grouping your data • To store information about your data • To read and write data at high speeds

  12. C. TDMS Files—File Format • TDMS file • Binary file (.tdms) that contains data and stores properties about the data • TDMS_Index file • Binary index file (*.tdms_index) that provides consolidated information on all the attributes and pointers in the TDMS file • Speeds up access to the data while reading • Automatically regenerated if lost • TDMS file format internal structure is publicly documented

  13. C. TDMS Files—Data Hierarchy • Channel • Stores measurement signals or raw data in a TDMS file • Each channel can have properties describing the data • The data stored in the signal is stored as binary data on disk to conserve disk space and improve efficiency • Channel Group • Segment of a TDMS file that contains properties and one or more channels • Use channel groups to organize your data and to store information that applies to multiple channels

  14. C. TDMS Files—Accessing TDMS Files • Use the Write to Measurement File and Read from Measurement File Express VIs • Allows you to quickly save and retrieve data from TDMS format • Very little control over your data grouping and properties • Use the TDM Streaming API • Set of functions for opening, writing to, reading from, and closing TDMS files • Allows you to organize your data into channel groups and channels • Use the TDM Excel Add-In Tool • Allows you to read TDMS files in Microsoft Excel

  15. C. TDMS Files—TDM Streaming API

  16. C. TDMS Files—Write Data • Streams data to the specified TDMS file • Data subset to write is determined by group name and channel name(s) inputs

  17. C. TDMS Files—Read Data • Reads the specified TDMS file and returns data from the specified channel and/or channel group

  18. C. TDMS Files—Set Properties • Sets the properties of the TDMS file, channel group, or channel

  19. C. TDMS Files—Get Properties • Returns the properties of the TDMS file, channel group, or channel

  20. C. TDMS Files—File Viewer • Opens TDMS file and presents the file data in the TDMS File Viewer dialog box

  21. Practice • Generate a set of waveforms and export them as a single CSV file. • Compute the waveforms PSDs and export them as a single CSV file. • Open both files in excel and check the results.

More Related