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.
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 palette and the Advanced File 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 Object | Description |
---|---|
Build Path | Creates a new path by appending a name or a relative path to an existing path. |
Close File | Closes an open file specified by refnum and returns the path to the file associated with the refnum. |
Format Into File | Formats 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 File | Opens 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 Delimited Spreadsheet | Reads 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 Binary File | Reads 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 File | Reads data from a text-based measurement file (.lvm) or binary measurement file (.tdm or .tdms). |
Read from Text File | Reads a specified number of characters or lines from a byte stream file. This function does not work for files inside an LLB. |
Scan From File | Scans 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 Path | Returns the name of the last component of a path and the stripped path that leads to that component. |
Write Delimited Spreadsheet | Converts 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. |
Write to Binary File | Writes 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 File | Writes data to text-based measurement files (.lvm), binary measurement files (.tdm or .tdms), or Microsoft Excel files (.xlsx). |
Write to Text File | Writes a string or an array of strings as lines to a file. This function does not work for files inside an LLB. |
Subpalette | Description |
---|---|
Advanced File VIs and Functions | Use the Advanced File VIs and functions to manipulate files, directories, and paths. |
Configuration File VIs | Use the Configuration File VIs to create, modify, and read a platform-independent configuration file. |
File Constants | Use the file constants with the File I/O VIs and functions. |
Storage/DataPlugin VIs | Use 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 website at ni.com/dataplugins to download DataPlugins. |
TDM Streaming VIs and Functions | Use the TDM Streaming VIs and functions to read and write waveforms and waveform properties to binary measurement files (.tdms). |
XML VIs and Functions | Use the XML VIs and functions to manipulate XML data. |
Zip VIs | Use the Zip VIs to create new zip files, to add files to zip files, to unzip zip files, and to close zip files. |
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.