Write values or an array of values to a binary file in LabVIEW with the Write to Binary File function.

To illustrate the principle of writing to binary files, this process describes creating an example binary file using a constant as the binary data.

To write numeric data to a binary file, complete the following steps.

  1. Add the Write to Binary File function to the block diagram.
  2. Wire the data you want to write to the binary file.
    1. Add a numeric constant to the block diagram.
    2. Wire the numeric constant to the data input of the Write to Binary File function.
    3. Enter a value into the numeric constant.
    You also can wire an array to the binary file.
  3. Run the VI.
  4. In the dialog box that appears, create a name for the file, such as number.bin.
    Presenting a dialog box to choose a file is the default behavior of Write to Binary File if the file input is unwired.
LabVIEW creates the file in the directory specified by the file input and stores the numeric data in the file.

Writing Binary Files Example

For an example of how the Write to Binary File function writes an array of double-precision, floating-point values to a binary file, refer to the Simple Binary File project in the labview\examples\File IO\Binary\Simple Binary folder.

After you write to a binary file, you can read the binary file.