Reading from Text Files

Complete the following steps to read characters or strings from a text file.

  1. Add a string indicator to the front panel.

     Add  Find
  2. Add the Read from Text File function to the block diagram.

     Add  Find
  3. Right-click the file input of the Read from Text File function and select Create»Constant. A path constant appears. Enter an absolute path for the file you wish to read from into the constant.
    Tip  To avoid typing out the path, you can drag a file from the desktop and drop it into the constant.
  4. Wire the text output of the Read from Text File function to the string indicator.
  5. Run the VI. The VI reads the text from the file you specified in the constant and displays the text in the front panel string indicator.

Refer to the Tab-Delimited Data project in the labview\examples\File IO\Spreadsheet\Tab-Delimited Data directory for an example that reads data from a text file and plots the data.

 Open example  Find related examples