Text and complex File I/O in labview
File I/O is used to pass data between your VI and certain data files.
The file I/O operations allow the user to perform any of the following:
• Opening and closing data files
• Reading from or writing to files including spreadsheets
• Managing files (moving, renaming, or changing file characteristics)
• Managing configuration files (creating, modifying, and reading)
Two types of file I/O VIs exist:
High-Level: performs common I/O operations all in one VI (i.e. opens,
reads, and closes file).
1) These VIs can be accessed in the Functions Palette:
• Functions Palette -> File I/O
2) These VIs can perform operations from the following data types:
• Characters to and from text files
• Lines from text files
• Arrays of single-precision numerics to and from spreadsheet
text files
• Arrays of single-precision numerics or signed 16-bit integers to
and from binary files
3)Pls. donot put low level vis in the loops and not high level one.
4) High-level VIs always need a file path input and if one is not
assigned, an error message will appear prompting for the file path.
Low-Level: performs only one I/O operation (i.e. reads file)
File I/O formats depend on the type of files being used. 3 types of formats
exist: text, binary, and datalog. Some basic guidelines for choosing a data type
are:
• Text files are the most common and should be used if the data will be
used in programs such as Word and Excel.
• Binary files are more efficient than text files with respect to disk space
and speed and should be used if memory and speed is crucial.
• Datalog files are the best way to store data if the data will only be
accessed in LabVIEW and if the data structure is complex.
Using File I/O in labview VI
Access File I/O operations by:
• Functions Palette -> All-Functions -> File I/O
• In addition to the File I/O operations, the user will need to identify the File Path
so that the VI knows where the file can be accessed. Insert a File Path Control
or Indicator by:
• Controls Palette -> All-Controls -> String & Path -> File Path
Control or File Path Indicator
EXAMPLE BLOCK DIAGRAM of TEXT FILE I/O labview VI
EXAMPLE BLOCK DIAGRAM of Numeric complex FILE I/O labview VI
Following labview VI is used to read numeric file data into labview and stores them to array. Note that text file need to have numeric data separated by tab space for multiple columns(if any). It also explains how complex data is read into labview using file I/O and array index. The complex data to be read should be separated into real and imaginary and need to store in a text file. Both real and image columns should be separated by tab space. The file I/O reads this complex data and array index in labview separates both real and imag part. This real and imag data is further combined into complex array in labview, which can be processed as desired.
Download Labview Source code of this FILE I/O example
Download TEXT FILE IO example labview VI
Download TEXT FILE TO READ
Download TEXT FILE TO WRITE
Download Numeric FILE IO example labview VI
Download 2D array IQ file numeric
Similar posts on Labview programming
Labview data types
Creating SubVI
Creating Array and Array operations
Cluster concepts in labview
Various plots in labview
File I/Os
For loop,while loop and case structure
Local variable vs Global variable concepts
Useful Links to Labview Source codes
Refer following as well as links mentioned on left side panel for useful labview source codes.
Hex to Binary labview VI
Decimal to Binary labview VI
Number Generator labview VI
Binary to Decimal labview VI
Binary number generator
modulator-demodulator
FFT
up and down sample
Cellular Telecommunications Tutorials -
RF Wireless World
WLAN 802.11ac 802.11ad wimax Zigbee z-wave GSM LTE UMTS Bluetooth UWB IoT satellite Antenna RADAR