Download LabVIEW Fundamentals

Transcript
Chapter 11
File I/O
Using VIs and Functions for Common File I/O Operations
The File I/O palette includes VIs and functions designed for common file
I/O operations, such as writing to or reading from the following types of
data:
•
Numeric values to or from spreadsheet text files
•
Characters to or from text files
•
Lines from text files
•
Data to or from binary files
The following block diagram shows how to use the Write To Spreadsheet
File VI to send numbers to a tab-delimited spreadsheet file. When you run
this VI, LabVIEW prompts you to write the data to an existing file or to
create a new file.
The open, read, and write functions expect a file path input. If you do not
wire a file path, a dialog box appears for you to specify a file to read from
or write to.
The File I/O palette includes functions to control each file I/O operation
individually. Use these functions to create or open a file, read data from or
write data to the file, and close the file. You also can use them to perform
the following tasks:
•
Create directories.
•
Move, copy, or delete files.
•
List directory contents.
•
Change file characteristics.
•
Manipulate paths.
© National Instruments Corporation
11-3
LabVIEW Fundamentals