LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

End of File Encountered

Solved!
Go to solution

Hi,

I am a novice to LabView. I tried to create a simple LabVIEW program to read data from saved file (see the attachment). But faced a problem with resting pointer. I want to resetting pointer to the beginning of the file. How should I do this or close file after every cycle? Can somebody help me to modify my coding.

 

Thanks for your help on this 

 

0 Kudos
Message 1 of 9
(10,461 Views)
Solution
Accepted by topic author lipwe

You are uisng express VIs, so the file gets opened, read and closed with every iteration of the loop. You are reading the same file over and over as fast as the computer allows, probably thousands of time per second. 😮

 

Since you are reading segments, you can check the EOF output and wire it to the "reset" input via a shift register so it resets whrenever it has reached the end of the file.

 

What is the purpose of your program?

 

Can you be more specific what you want to do?

Message 2 of 9
(10,450 Views)

Hi Altenbach,

This VI is created with data acquisition VI(see the attachment) as a part of my training. I collect data from my acquisition VI. Then I need to read those acquired file and multiply every value by a multiplication factor. So problem is when I put while loop around entire coding, I got an error message saying that End of File encounter. So I search the forum to see the problem. I did what you suggested. It wok

0 Kudos
Message 3 of 9
(10,431 Views)

Why don't you just read the entire file at once?

0 Kudos
Message 4 of 9
(10,408 Views)

I don't know how to do that 

0 Kudos
Message 5 of 9
(10,361 Views)

lipwe,

 

If you know the total amount of samples in your .lvm file, you can specify it in the express VI properties (right click on the "Read From Measurement File" -> properties or double click on it) in order to read in the entire thing at once.  The nature of a LabVIEW Measurements File is that measurements are arranged into sections.  For example, you could have temperature measurements followed by pressure measurements.  Therefore, if you have different types of measurements in each section, this method should not be used unless you have a specific reason to.  In order to read the entire file at once, I would keep your while loop and wire the EOF? line from the "Read From Measurement File" VI into the stop loop condition (stop sign).  This should allow you to exit the loop once you have read and plotted all of your data.  If you want to keep your stop button, you can use an "Or" from the Boolean Palette.  To read more about LabVIEW Measurement Files, please see the link below:

 

http://www.ni.com/white-paper/4139/en/

 

Message 6 of 9
(10,306 Views)

Hello, I am having the same problem as well. I would be very grateful if you could share the solved vi?

0 Kudos
Message 7 of 9
(10,240 Views)

s.s.lee,

 

Please see the attached VI which is an edited version of lipwe's file.  Here I make two writes to a measurement file, each write consists of 100 random numbers between 0 and 1.  In the following loop, I read the same file until the EOF? line on the "Read From Measurement File" Express VI returns true.  Since I only made 2 writes to the measurement file, the EOF? line returns true on the second iteration of the while loop.  All while loops in LabVIEW must execute at least once, therefore, the last iteration of the loop completes before LabVIEW exits the while loop.  Meanwhile, I use the "Append Waveforms" VI to concatinate my waveform data.  Once the loop is done executing, it is plotted to the waveform graph.

 

If you want to run this VI, edit the filename in the properties of the "Write To Measurements File" Express VI to match the file architecture of your system.

 

Sean M.

Applications Engineer

National Instruments

0 Kudos
Message 8 of 9
(10,203 Views)

Thank you very much, S. Moore.

0 Kudos
Message 9 of 9
(10,181 Views)