Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Write To Measurement File

Dialog Box Options

ParameterDescription
File NameDisplays the full path to the file to which you want to write data. The Express VI writes data to the file that this parameter specifies only if the File Name input is unwired. If you wire the File Name input, the VI writes data to the file that this input specifies instead.
File FormatContains the following options:
  • Text (LVM)—Sets the file format to text-based measurement file (.lvm) and the file extension in File Name to .lvm.

    When you select this file format, you enable the Read generic text files checkbox. Selecting this checkbox allows you to read data from generic text files.
  • Binary (TDMS)—Sets the file format to binary measurement file (.tdms) and the file extension in File Name to .tdms. If you select this option, the Delimiter section and the No headers option in the Segment Headers section are not available.
  • Binary with XML Header (TDM)—Sets the file format to binary measurement file (.tdm) and the file extension in File Name to .tdm. If you select this option, the Delimiter section and the No headers option in the Segment Headers section are not available.

    When you select this file format, you enable the Lock file for faster access checkbox. Selecting this checkbox makes reading and writing significantly faster (at the expense of the ability to multitask certain activities). It is recommended that you use this option in most cases.
    Note  When this option is enabled, no two Express VIs can access the same file at the same time when one of them is writing a "series of files."
ActionContains the following options:
  • Save to one file—Saves all the data to one file.
  • Ask user to choose file—Displays a dialog box that prompts users to select a file.
  • Ask only once—Prompts users to select a file only once. This option is available only when you place a checkmark in the Ask user to choose file checkbox.
  • Ask each iteration—Prompts users to select a file each time the Express VI runs. This option is available only when you place a checkmark in the Ask user to choose file checkbox.
  • Save to series of files (multiple files)—Saves the data to multiple files. If Reset is TRUE, the VI starts at the first file in the series. For example, if test_001.lvm has been saved to test_004.lvm, test_001.lvm might be renamed, overwritten, or skipped based on the value of the Existing Files option in the Configure Multi-file Settings dialog box.
  • Settings—Displays the Configure Multi-file Settings dialog box. This option is available only when you place a checkmark in the Save to series of files (multiple files) checkbox.
If a file already existsContains the following options:
  • Rename existing file—Renames the existing file if Reset is TRUE.
  • Use next available name—Appends the next sequential number to the filename if Reset is TRUE. For example, if test.lvm exists, LabVIEW saves the file as test1.lvm.
  • Append to file—Appends the data to the existing file. The VI ignores the value of Reset if you select the Append to file option.
  • Overwrite file—Replaces data in an existing file if Reset is TRUE.
Segment HeadersContains the following options:
  • One header per segment—Creates one header per segment in the file to which LabVIEW writes the data. Select this option if the acquisition rate of the data changes over time, if you acquire two or more signals at different acquisition rates, or if the list of signals you log changes over time.
  • One header only—Creates only one header in the file to which LabVIEW writes the data. Select this option if you acquire the same list of signals at the same constant acquisition rate.
  • No headers—Does not create a header in the file to which LabVIEW writes the data.
    Note  This option is available only when you select the Text (LVM) option from the File Format section.
X Value ColumnsContains the following options:
  • One column per channel—Creates a separate column for time data each channel generates. This option includes a column of values from the x-axis for every column of values from the y-axis. Select this option if you acquire signals of different types or at different acquisition rates.
  • One column only—Creates only one column for the time data the channels generate. This option includes only one column of values from the x-axis. Select this option if you acquire signals at the same acquisition rate.
  • Empty time column—Creates an empty column for the time data each channel generates. This option does not include the data from the x-axis.
    Note  These options are available only when you select the Text (LVM) option from the File Format section.
DelimiterContains the following options:
  • Tab—Uses tabs to delimit fields in the text file.
  • Comma—Uses commas to delimit fields in the text file.
    Note  These options are available only when you select the Text (LVM) option from the File Format section.
File DescriptionContains the description of the .lvm, .tdm, or .tdms file. LabVIEW appends the text you enter in this text box to the header of the file.
  • Advanced—Displays the Configure User-Defined Properties dialog box. This option is available only when you select the Binary (TDMS) or Binary with XML Header (TDM) options from the File Format section.

Block Diagram Inputs

ParameterDescription
SignalsContains the input signal or signals. If you wire two or more signals with the same name to the Signals input, LabVIEW appends an integer to the end of the names written in the file, which enforces unique channel names. For example, if you wire two signals named Sine to the Signals input, LabVIEW writes the names as Sine and Sine 1.
ResetIf TRUE, stops and restarts writing data to the .lvm, .tdm, or .tdms file based on the Action or If a file already exists options you select in the Configure Write Measurement File dialog box. The default is FALSE.
EnableEnables or disables the Express VI. The default is ON or TRUE.
new_fileIf TRUE, stops writing to the current file, creates the next file in the series, and writes to that file instead. This option is available only when you place a checkmark in the Save to series of files (multiple files) checkbox.
error in (no error)Describes error conditions that occur before this VI or function runs.
DAQmx TaskSpecifies the DAQmx task to use to populate data on the DAQmx Properties page of the Configure User Defined Properties dialog box.
CommentAppends a comment to each data set written to the .lvm or .tdm file.
File NameSpecifies the name of the file to which you want to write data. If File Name is not wired, the VI uses the File Name specified in the configuration dialog box.

Block Diagram Outputs

ParameterDescription
File Name OutReturns the name of the file.
Saving DataIndicates if the Express VI is saving the data.
error outContains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces.

Write To Measurement File Details

Note  The behavior of this VI changes depending upon the target. If the current target does not or might not have a host computer connected, the configuration dialog box displays warnings next to options that are invalid without a host. If you configure this VI to prompt for input and run the VI on a target with no user interface, such as the Real-Time Module with no host computer connected, this VI returns an error.

You can also use the Storage VIs to read from and write to .tdm files, or you can use the TDM Streaming functions to read from and write to .tdms files.

This Express VI operates similarly to the following VIs and functions:

Open/Create/Replace File
Write to Text File
Write to Binary File
Write To Spreadsheet File
File Dialog
Format Into File

Examples

Refer to the following VIs for examples of using the Write To Measurement File VI:

  • Cycle Analysis VI: labview\examples\express
  • TDMS - Express write data (time and frequency domain) VI: labview\examples\file\plat-tdms.llb
  • TDMS - Express write data (time domain) VI: labview\examples\file\plat-tdms.llb

Resources


 

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