Writing to Datalog Files
- Updated2025-08-15
- 1 minute(s) read
Complete the following steps to write each record to a file in the form of a cluster.
- Add the Open/Create/Replace Datalog function to the block diagram.
- 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.
- 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.
- Add the Write Datalog function to the block diagram.
- Wire the refnum out output of the Open/Create/Replace Datalog function to the refnum input of the Write Datalog function.
- Create a control or constant to represent the data record and wire it to the record(s) input of the Write Datalog function.
- Close the datalog file.
- Add the Close File function to the block diagram.
- Wire the refnum out output of the Write Datalog function to the refnum input of the Close File function.
- 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.