Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

File I/O VIs and Functions

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Owning Palette: Programming VIs and Functions

Requires: Base Development System. This topic might not match its corresponding palette in LabVIEW depending on your operating system, licensed product(s), and target.

Use the File I/O VIs and functions to open and close files, read from and write to files, create directories and files you specify in the path control, retrieve directory information, and write strings, numbers, arrays, and clusters to files.

Example

Use the VIs and functions on this palette to perform common I/O operations and other types of file I/O operations. You can read or write various types of data, such as characters or lines in text files, numeric values in spreadsheet text files, or data in binary files.

The File I/O Vis and functions palette and the Advanced File functions palette include 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 the functions to create directories; move, copy, or delete files; list directory contents; change file characteristics; or manipulate paths.

Palette ObjectDescription
Build PathCreates a new path by appending a name (or relative path) to an existing path.
Close FileCloses an open file specified by refnum and returns the path to the file associated with the refnum.
Format Into FileFormats string, numeric, path, or Boolean data as text and writes the text to a file. If you wire a file refnum to the file input, writing begins at the current file position. To append to an existing file, open the file and set the file position to the end of the file by using the Set File Position function. Otherwise, the function will open the file and write to the beginning of the file. This function does not work for files inside an LLB.
Open/Create/Replace FileOpens an existing file, creates a new file, or replaces an existing file, programmatically or interactively using a file dialog box. This function does not work for files inside an LLB.
Read from Binary FileReads binary data from a file and returns it in data. How the data is read depends on the format of the specified file. This function does not work for files inside an LLB.
Read From Measurement FileReads data from a text-based measurement file (.lvm) or binary measurement file (.tdm or .tdms).
Read From Spreadsheet FileReads a specified number of lines or rows from a numeric text file beginning at a specified character offset and converts the data to a 2D, double-precision array of numbers, strings, or integers. You must manually select the polymorphic instance you want to use.
Read from Text FileReads a specified number of characters or lines from a byte stream file. This function does not work for files inside an LLB.
Scan From FileScans text in a file for string, numeric, path, and Boolean data, converts the text to a data type, and returns a duplicated refnum and the converted outputs in the order scanned. This function does not work for files inside an LLB.
Strip PathReturns the name of the last component of a path and the stripped path that leads to that component.
Write to Binary FileWrites binary data to a new file, appends data to an existing file, or replaces the contents of a file. This function does not work for files inside an LLB.
Write To Measurement FileWrites data to text-based measurement files (.lvm), binary measurement files (.tdm or .tdms), or Microsoft Excel files (.xlsx).
Write To Spreadsheet FileConverts a 2D or 1D array of strings, signed integers, or double-precision numbers to a text string and writes the string to a new byte stream file or appends the string to an existing file. Wire data to the 2D data input or 1D data input to determine the polymorphic instance to use or manually select the instance.

Use this VI to transpose or separate data.

Note  To format with Microsoft Excel, use ActiveX with LabVIEW or the Report Generation Toolkit for Microsoft Office.
Write to Text FileWrites a string or an array of strings as lines to a file. This function does not work for files inside an LLB.


SubpaletteDescription
Advanced File VIs and FunctionsUse the Advanced File VIs and functions to manipulate files, directories, and paths.
Configuration File VIsUse the Configuration File VIs to create, modify, and read a platform-independent configuration file.
File ConstantsUse the file constants with the File I/O VIs and functions.
Storage/DataPlugin VIsUse the Storage/DataPlugin VIs to read measurement data from a variety of file formats, write data to .tdm or .tdms files, or manage DataPlugins installed on the local computer. You must download appropriate DataPlugins and register them on the local computer before you can access the corresponding file formats. Refer to the National Instruments Web site at ni.com/dataplugins to download DataPlugins.

Refer to the NI Developer Zone at ni.com/zone for information about using the Storage/DataPlugin VIs with an ASAM-ODS database.
TDM Streaming VIs and FunctionsCopyright: (c) 2013 National Instruments. All rights reserved.

Use the TDM Streaming VIs and functions to read and write waveforms and waveform properties to binary measurement files (.tdms).
XML VIs and FunctionsUse the XML VIs and functions to manipulate XML data.
Zip VIsUse the Zip VIs to create new zip files, to add files to zip files, to unzip zip files, and to close zip files.

Example

Refer to the Array to Spreadsheet String VI in the labview\examples\Arrays directory for an example of using the File I/O VIs and Functions.


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit