From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

End Of File Error

Hi,
 
I'm currently writing a program that takes data from a spectrum analyzer (HP 8594E) and displays it on a front panel. The functions of my vi also  include saving the data to a file and also outputting that file back onto the waveform. I can save and display the data file once, but when i save and display it again, I get an "error 4: end of the file encountered" error. I've double checked the properties on both Write and read to measurement file VI's and the file types are the same, but the error still occurs. Do you know how to solve this error?
 
I've attached my VI in case you'd like to look at it.
 
Also, when I have the outputted data file onto the waveform, the x-axis is always labelled as time, I tried rewriting the label as frequency, but it just overwrites it and replaces the label with "time." Any suggestions?
 
Thank you,
Sammy
0 Kudos
Message 1 of 16
(3,857 Views)
for some reason my computer wont open ur vi. sry (im using a g5 mac osx 10.4.7. that might hav something to do with it. also what verson is ur vi pls hav it in 7.1 format tks.)
some thing to try thou is to seek to the begining after u write it. that will fix it if it is becuse the marker is at the wrong position
0 Kudos
Message 2 of 16
(3,846 Views)
Hi vivi,
 
Thanks for your help. Unfortunately, I'm using LabView 8.0, and this computer doesn't have LabView 7.1. Smiley Sad Darn LabView updates...
 
- Sammy
0 Kudos
Message 3 of 16
(3,838 Views)
you can tell it to go back to the prev ver by clicking on file-->save with options-->save for prev.
0 Kudos
Message 4 of 16
(3,828 Views)
Looks like this might be your answer. It appears to be a limitation in the Express VI itself that won't allow multiple read accesses after the end of the file has been reached (even if new data is appended).

I do have a workaround, however, that isn't listed in the KnowledgeBase listed above that should only take a couple seconds to implement. The reason this error is occuring is that this VI "remembers" that it has already run before and encountered the EOF. It does this by setting internal flags. My trick will be to wipe the VIs memory after every time it runs. You might want to try this on a backup copy of your VI first. Here's how:

First, we will need to convert the Read from Measurement File Express VI into a normal VI. You can do this by right clicking the VI and selecting Open Front Panel. A dialog will ask you if you want to convert. Select Yes. Your Express VI has now been turned into a normal VI whose parameters you set are hard-coded into the VI. In other words, you won't be able to use the configuration dialog to change any more settings at this point.

Save your new VI with whatever name you choose. Now that the Express VI is a normal VI, we can change the way a VI is loaded into memory as a subVI (this is a NEW feature in LabVIEW 8, and one of the really cool ones). Right click the new VI and select Call Setup. It will bring up a dialog asking you how you want to load the subVI. "With Callers" just means a completely normal subVI. We want the option called "Reload for each call". This means that every time the VI is called, it is loaded into memory, and then unloaded from memory when it is finished executing. This, in effect, wipes the VI's memory after every call. Check out the modified VI I created below. After taking these steps, there is no more Error 4 when calling this VI in a loop. Hope this helps!

Message Edited by Jarrod S. on 07-06-2006 10:36 AM

Jarrod S.
National Instruments
Download All
Message 5 of 16
(3,818 Views)
Oh yeah, and to answer your second question. Your x-axis keeps changing to Time because your graph is reading the Dynamic Data and using its attributes to set its own labels. Dynamic data includes lots of information about data such as units. The default x-axis unit is time in seconds.

Since you don't want to use this default attribute, right click your graph and select Ignore Attributes from the shortcut menu. Then rename the axis Frequency. That will solve your problem.
Jarrod S.
National Instruments
0 Kudos
Message 6 of 16
(3,816 Views)

Hi Jarrod,

Thanks for the help! You're right, I dont get that Error 4 message anymore! Smiley Very Happy

I have some more questions. When I save the measurements to a file on my VI, my vi then outputs what I saved on the spectrum analyzer. But when i save it again, the display doesn't change at all. I know that there are noticeable miniscule changes on the spectrum analyzer as it runs in real time, but the display on my VI doesn't change at all. Also, when I open the destination file that I saved the plot to (after clicking "save" numerous times when the vi was running to double check if the display changed at all), I get a long list of measurements and apparently, everytime i click save, the measurements were appended to the end of the file. This is weird because I already told the "Write to Measurement File.vi" to overwrite file if a file name already exists. There isn't any append to file setting for "Read from Measurement File.vi." Do you know what could be wrong?

Also, the display from the saved file seems like it's been offsetted to the right compared to the display of that from the "dump" function. Could it be possible that the "Write to Measurement File.vi" starts the x-axis from 0? I've included a picture of this occurrence and my vi.

Thanks Jarrod for the help!

- Sammy

 

Download All
0 Kudos
Message 7 of 16
(3,803 Views)
Sammy,

The Help file for the Write to Measurement File says that overwriting of the file occurs if Reset is True. You do not have reset wired. Try that.

I suspect that the coversion of your negative start frequency to a timestamp datatype is the source fo the offset problem, but I have not checked it.

Lynn
0 Kudos
Message 8 of 16
(3,800 Views)

Hi Lynn,

I don't see the reset parameter on the Read Measurement vi. Do you mean overwrite samples parameter?

Thanks,

Sammy

0 Kudos
Message 9 of 16
(3,781 Views)

Hi Lynn,

Nevermind! I know what you mean now. Haha..Thanks!! The display from the file is changing everytime I press save now. Although the offset still occurs. I'm not sure what's happening there. Could you help me out on that issue too?

Thank you so much,

Sammy

0 Kudos
Message 10 of 16
(3,779 Views)