LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading lines from a text file

Solved!
Go to solution

I've tried to create a program that will read the line i choose from a text file, turn it into an array of strings and index the array. 

 

The text file is set up as:

AA

BB

CC

DD

etc.

 

However, when i start the program there is no output from the "read from text file" part.

I've tried to troubleshoot it but i can't seem to get anywhere.

 

Program is attached

0 Kudos
Message 1 of 4
(1,136 Views)
Solution
Accepted by spencer382

You really should be checking your errors coming from the opening and reading of the file.  My guess is your path is wrong.

 

An additional note, you don't actually need the Open/Create/Replace File function here.  You can wire the path directly to the Read Text File.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(1,129 Views)

I took out the Open/Create/Replace File function and redefined my path and it worked.

 

Thanks 🙂

0 Kudos
Message 3 of 4
(1,121 Views)

Does the file get changed constantly by other applications or is it static? If static, read it before the loop.

 

We can only see a truncated diagram picture. Hard to tell how reasonable the entire code is.

 

  • How often does "Line" change?
  • What should happen if it is larger than the available elements?
  • You don't need to wire the indices if you want the elements in order starting with zero (blue array).
  • etc.
0 Kudos
Message 4 of 4
(1,113 Views)