Writing to Datalog Files

Complete the following steps to write each record to a file in the form of a cluster.

  1. Add the Open/Create/Replace Datalog function to the block diagram.

     Add  Find
  2. Right-click the operation input of the Open/Create/Replace Datalog function and select Create»Constant from the shortcut menu. Select create from the enumerated constant that appears.
  3. Create a cluster that matches the data record and wire the cluster to the record type input of the Open/Create/Replace Datalog function. The cluster specifies how LabVIEW writes the data to the file.
  4. Add the Write Datalog function to the block diagram.

     Add  Find
  5. Wire the refnum out output of the Open/Create/Replace Datalog function to the refnum input of the Write Datalog function.
  6. Create a control or constant to represent the data record and wire it to the record(s) input of the Write Datalog function.
  7. Close the datalog file.
    1. Add the Close File function to the block diagram.

       Add  Find
    2. Wire the refnum out output of the Write Datalog function to the refnum input of the Close File function.
  8. After you write to a datalog file, read the file.

Refer to the Datalog File project in the labview\examples\File IO\Datalog directory for an example of saving a simulated temperature reading and the time stamp in a LabVIEW datalog file.

 Open example  Find related examples