Skip to content Skip to navigation

Connexions

You are here: Home » Content » File I/O VIs and Functions

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • NSF Partnership display tagshide tags

    This module is included inLens: NSF Partnership in Signal Processing
    By: Sidney BurrusAs a part of collection: "LabVIEW Graphical Programming Course"

    Click the "NSF Partnership" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

  • National Instruments display tagshide tags

    This module is included in aLens by: National InstrumentsAs a part of collection: "LabVIEW Graphical Programming Course"

    Comments:

    "A full introductory course on programming with LabVIEW."

    Click the "National Instruments" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Also in these lenses

  • Lens for Engineering

    This module is included inLens: Lens for Engineering
    By: Sidney Burrus

    Click the "Lens for Engineering" link to see all content selected in this lens.

  • eScience, eResearch and Computational Problem Solving

    This module is included inLens: eScience, eResearch and Computational Problem Solving
    By: Jan E. OdegardAs a part of collection: "LabVIEW Graphical Programming Course"

    Click the "eScience, eResearch and Computational Problem Solving" link to see all content selected in this lens.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
Download
x

Download module as:

  • PDF
  • EPUB (what's this?)

    What is an EPUB file?

    EPUB is an electronic book format that can be read on a variety of mobile devices.

    Downloading to a reading device

    For detailed instructions on how to download this content's EPUB to your specific device, click the "(what's this?)" link.

  • More downloads ...
Reuse / Edit
x

Module:

Add to a lens
x

Add module to:

Add to Favorites
x

Add module to:

 

File I/O VIs and Functions

Module by: National Instruments. E-mail the author

Summary: In this lesson, you will learn about file I/O operations.

File I/O operations pass data to and from files. Use the File I/O VIs and functions located on the Functions>>All Functions>>File I/O palette to handle all aspects of file I/O, including the following:

  • Opening and closing data files
  • Reading data from and writing data to files
  • Reading from and writing to spreadsheet-formatted files
  • Moving and renaming files and directories
  • Changing file characteristics
  • Creating, modifying, and reading configuration files

File I/O VIs

The File I/O palette is divided into four types of operations: high-level, low-level, advanced, and express.

High-Level File I/O VIs

Use the high-level File I/O VIs located on the top row of the Functions>>All Functions>>File I/O palette to perform common I/O operations. Refer to the High-Level File I/O VIs section for more information about the high-level File I/O VIs.

You can save time and programming effort by using the high-level VIs to write to and read from files. The high-level VIs perform read or write operations in addition to opening and closing the file. If an error occurs, the high-level VIs display a dialog box that describes the error. You can choose to halt execution or to continue. However, because high-level VIs encapsulate the entire file operation into one VI, they are difficult to customize to any use other than the one intended. Use low-level VIs for more specific tasks.

Low-Level and Advanced File I/O VIs and Functions

Use the low-level File I/O VIs and functions located on the middle row of the Functions>>All Functions>>File I/O palette and the Advanced File I/O functions located on the Functions>>All Functions>>File I/O>>Advanced File Functions palette to control each file I/O operation individually.

Use the principal low-level functions to create or open a file, write data to or read data from the file, and close the file. The low-level VIs and functions can handle most file I/O needs. Refer to the LabVIEW Basics II: Development Course Manual for more information about the Advanced File I/O functions.

File I/O Express VIs

The Express VIs on the File I/O palette include the Read LabVIEW Measurement File Express VI and the Write LabVIEW Measurement File Express VI. The LabVIEW measurement data file (.lvm) is a tab-delimited text file you can open with a spreadsheet application or a text-editing application. In addition to the data an Express VI generates, the .lvm file includes information about the data, such as the date and time the data was generated.

Refer to the Data Acquisition and Waveforms section, for more information on using the File I/O Express VIs.

LabVIEW Data Directory

dddIcon.png Use the default LabVIEW Data directory to store the data files LabVIEW generates, such as .lvm or .txt files. LabVIEW installs the LabVIEW Data directory in the default file directory for your operating system to help you organize and locate the data files LabVIEW generates. By default, the Write LabVIEW Measurement File Express VI stores the .lvm files it generates in this directory, and the Read LabVIEW Measurement File Express VI reads from this directory. The Default Data Directory constant, shown in Media 1, and the Default Data Directory property also return the LabVIEW Data directory by default.

Select Tools>>Options and select Paths from the top pull-down menu to specify a different default data directory. The default data directory differs from the default directory, which is the directory you specify for new VIs, custom controls, VI templates, or other LabVIEW documents you create.

Basics of File I/O

A typical file I/O operation involves the following process:

  1. Create or open a file. Indicate where an existing file resides or where you want to create a new file by specifying a path or responding to a dialog box to direct LabVIEW to the file location. After the file opens, a refnum represents the file. A reference number, or refnum, is a unique identifier for an object, such as a file, device, or network connection.
  2. Read from or write to the file.
  3. Close the file.

Content actions

Download module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

Reuse / Edit:

Reuse or edit module (?)

Check out and edit

If you have permission to edit this content, using the "Reuse / Edit" action will allow you to check the content out into your Personal Workspace or a shared Workgroup and then make your edits.

Derive a copy

If you don't have permission to edit the content, you can still use "Reuse / Edit" to adapt the content by creating a derived copy of it and then editing and publishing the copy.