Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Example Program
NI Supported: Yes
Publish Date: Sep 6, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Creating and Reading Binary Files for 2D Arrays in LabVIEW

0 ratings | 0.00 out of 5
Print

Downloads

Filename: binaryfilereader.vi
Requirements: View

Filename: binaryfilewriter.vi
Requirements: View

The attached examples demonstrate how to write data from a 2D array to a binary file and how to read data from a binary file and display the data as a 2D array.

After you download the VIs, run BinaryFileWriter.vi. This VI shows two methods of saving a 2D array as a binary file with a header. The first method creates a binary file with a user programmed header. LabVIEW needs an 8-byte header describing the number of rows and columns in a 2D array. The second method creates a binary file with a LabVIEW generated header. In this method, the header input to the Write File function is set to TRUE. Both methods produce identical files on disk, but in the second method, LabVIEW does the work.

If you leave all of the fields as the default values, running BinaryFileWriter.vi creates two files, each containing data of a 2D array, with the following paths:
File One : C:\data1.dat
File Two : C:\data2.dat

After you run BinaryFileWriter.vi, run BinaryFileReader.vi. This VI opens one of the binary files created by BinaryFileWriter.vi and displays the data as a 2D array.

If you leave the path of the file to be opened as the default value and BinaryFileWriter.vi has been executed with its default values, then running BinaryFileReader.vi opens the binary file "C:\data1.dat" and displays the data.

Requirements


Filename: binaryfilereader.vi

Software Requirements


Application Software: LabVIEW Full Development System 6.1
Language(s): LabVIEW

 
Filename: binaryfilewriter.vi

Software Requirements


Application Software: LabVIEW Full Development System 6.1
Language(s): LabVIEW

 
0 ratings | 0.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).