Empty Array of Data or Error 1 When Reading from a Binary File in LabVIEW

Updated Jan 14, 2019

Reported In


  • LabVIEW Full

Issue Details

Using LabVIEW, I write an array to a binary file using the Write File function. Later in my VI, I open the binary file and try to read the binary data back into LabVIEW, using the Read File function. Since I want to read an array from the binary file, I wire an array constant of my data type to the Data Type input terminal of the Read File function. I have an array indicator wired from the data output terminal of the Read File function to view the data read from the binary file. When I run the VI, I either receive an empty array of data in my indicator or Error 1: an input parameter is invalid. Why am I not able to read the data from the binary file?


If you want to read an array of a certain data type from the binary file:
  1.  Wire a single constant of the data type (numeric, string, cluster, etc.) to the Data Type input terminal on the Read File function. This tells the Read File function what data type the binary file is composed of.
  2. Wire the size of the array to be read into the count input terminal of the Read File function. This tells the Read File function that it is reading an array of data and not just a single element.

Note: Even if you want to read a 2-dimensional array from the binary file, you will want to follow the same steps mentioned above. The data returned from the Read File function will be a 1-dimensional array. However, you can reshape it to a 2-dimensional array using the Reshape Array function.

Additional Information

There are several examples in the LabVIEW Example Finder (Help»Find Examples...) under Fundamentals»File Input and Output»Binary that demonstrate how to use Write File and Read File functions.