LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading from file in a loop

I am trying to read from a measurement .lvm file.  When I plot the file data on a waveform chart, it works fine. But once the file reaches EOF, the VI stops which is expected.  I want to put this in while loop and once the file reaches EOF, I want the VI to again start reading the file from the beginning. So the VI will just continue reading from file forever, reahc EOF and again go bakc to first row. Any idea how this can be done ?
 
Regards
Rachana
 
0 Kudos
Message 1 of 9
(3,446 Views)

Hello,

I can change your existent code to that purpose. Please send it and refer your labview version.

 

Software developer
www.mcm-electronics.com





PORTUGAL
0 Kudos
Message 2 of 9
(3,442 Views)
Why do you want to keep reading the data from a file? If you want to continuously display data, read the entire file and just keep cycling through that.
0 Kudos
Message 3 of 9
(3,440 Views)
Hello.
 
Here is the file. I am using Labview 8.2 currently.
 
Regards
Rachana
0 Kudos
Message 4 of 9
(3,425 Views)

That is what I am trying to do. May something like reading in an array first and then read through it continuously. No luck so far though.

Regards

Rachana

0 Kudos
Message 5 of 9
(3,424 Views)

First of all, you are apparently using a graph, not a chart as you claim. There is a difference.

How big is the datafile? Can you attach that too?

0 Kudos
Message 6 of 9
(3,419 Views)
Here is the data file. I changed the extension from lvm to txt as this message does not support lvm file attachments.  But anyway extension doesn't matter.
0 Kudos
Message 7 of 9
(3,412 Views)

You probably have a few misunderstanding on how LabVIEW works. You have a graph hooked up and thus you plot the entire datafile at once. If you would just re-read the same file from the beginning and graph it again, nothing would change unless the data in the file got somehow changed by a different program. Unless this is the case, reading it once is sufficient. The graph only needs to be updated if new data arrives, in the meantime it will keep the current data displayed even if you would stop the VI.

How much data do you want to display at each iteration? If you want to chart the data one point at a time and then start over with the first datapoint once you run out of elements, you could do something like in the attached.

There are many other possibilities, so please let us know exactly how you want the data displayed over time.

0 Kudos
Message 8 of 9
(3,402 Views)
Thank you.  This will work.  What I am trying is read from the file and output the data at each iteration for some next calculations. However for my application, if the file ends, I can just repeat the data for next calculations.  Calculations however change at each iteration but data can repeat.
 
Thanks again
Rachana
0 Kudos
Message 9 of 9
(3,398 Views)