Keeping Track of Front Panel Data After Running

Updated Jun 11, 2018

Reported In

Software

  • LabVIEW Full

Issue Details

Can I keep track of my front panel data? I want to load values used in a previous run to the front panel programmatically.

Solution

You can use front panel data logging to record data for use in VIs and reports.
Automatic Data Logging:
  • Select Operate»Log at Completion to enable automatic logging.
Interactive Data Logging:
  • Select Operate»Data Logging»Log to enable interactive logging.
Viewing the Logged Front Panel Data Interactively:
  • After you log data, you can view it interactively by selecting Operate»Data Logging»Retrieve. The data retrieval toolbar appears as follows.

The above image shows:
  • Highlighted number ('0') - Data being viewed
  • Numbers in square brackets ('[0..0]') - Range of Logged records for this VI
  • Trash button - Toggles marked/unmarked for delete
  • OK button - Exit retrieval mode
  • Increment Arrows - View next/previous record
  • Date and Time - When the selected record was logged
Deleting a Record:
  • Select Operate»Data Logging»Purge Data to delete all the records you marked for deletion.​
Retrieving Front Panel Data Using a SubVI:
  • When you right-click a subVI and select Enable Database Access from the shortcut menu, a yellow box appears around the subVI, as shown in the following block diagram.

When you enable database access for the subVI, the inputs and outputs of the subVI actually act as outputs, returning their logged data. 
  • record # indicates the record to retrieve
  • invalid record # indicates whether the record number exists
  • timestamp is the time the record was created
front panel data is a cluster of the front panel objects. You can access the data of a front panel object by wiring the front panel data cluster to the Unbundle function.
You also can retrieve values for specific inputs and outputs by wiring directly to the corresponding terminal on the subVI, as shown in the following block diagram.

If you run the VI, the subVI does not run. Instead, it returns the logged data from its front panel to the VI front panel as a cluster.

Additional Information

Note: LabVIEW does not support front panel data logging through remote panels.
Automatic Data Logging:
  • The first time you log front panel data for a VI, LabVIEW prompts you to name the datalog file. You can use any file extension, for example .dat or .txt, for datalog files.
  • LabVIEW logs data each time you run the VI and appends a new record to the datalog file each additional time you run the VI. You cannot overwrite a record after LabVIEW writes it to a datalog file.
Interactive Data Logging:
  • LabVIEW appends the data to the datalog file immediately. Log your data interactively so you can select when to log the data. Logging your data automatically logs the data each time you run the VI.
 Note: If you display a subVI or an Express VI as an expandable node, you cannot enable database access for that node.
Specifying Records:
The subVI has n logged records, and you can wire any number from –n to n – 1 to the record # terminal of the subVI. You can access records relative to the first logged record using non-negative record numbers. 0 represents the first record, 1 represents the second record, and so on, through n – 1, which represents the last record.

You can access records relative to the last logged record using negative record numbers. –1 represents the last record, –2 represents the second to the last, and so on, through –n, which represents the first record. If you wire a number outside the range –n to n – 1 to the record # terminal, the invalid record # output is TRUE, and the subVI retrieves no data.

LabVIEW Data Directory:
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 To Measurement File Express VI stores the .lvm or .tdm files it generates in this directory, and the Read From Measurement File Express VI reads from this directory. The default data directory constant and the Application:Default:Data Directory property also return the LabVIEW Data directory by default.
Select Tools»Options and select Paths from the Category list 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.

Text-Based Measurement File:
The text-based measurement file (.lvm) includes data the Write To Measurement File Express VI generates. The text-based measurement file 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. LabVIEW saves data with up to six digits of precision in a .lvm file.
Use the Read From Measurement File Express VI to read data from a .lvm file.
The .lvm file uses commas as delimiters between numbers. To convert data in a .lvm file from a string to a number, specify the decimal separator as a period by using the localization code format specifier.
Refer to the NI Developer Zone for more information about .lvm files.

Binary Measurement File:
The binary measurement file (.tdm or .tdms) includes data the Write To Measurement File Express VI, the Storage/DataPlugin VIs, or the TDM Streaming VIs and functions generate. The .tdm file uses an XML-based format to store waveform properties and links to a binary file that contains waveform data. The .tdms file stores waveform properties and is a binary file that contains waveform data. Binary measurement files provide higher accuracy, take up less space on disk, and perform faster than LabVIEW measurement data files (.lvm).
You can use a binary measurement file to exchange data between NI software, such as LabVIEW and DIAdem.
(Windows) You can use the Read From Measurement File Express VI and the Write To Measurement File Express VI to read data from and write data to .tdm files. You can use the Storage/DataPlugin VIs to read data from and write data to .tdm files. You can use the TDM Streaming VIs and functions to read data from and write data to .tdms files.
Note: (MathScript RT Module) You also can use the MathScript RT Module save function and the load function to save variables to and load variables from .tdm or .tdms files.

WAS THIS ARTICLE HELPFUL?

Not Helpful