LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Oddness With Reading TDMS File - End Of File

Okay so I have a TDMS file that I've logged some data to.  Now I'm reading the data back and I'm getting an End Of File encountered error, but there is more data to read.  Here is some of what I'm talking about.

 

Example_VI.png

 

Here I open the file, then read all the bytes remaining after offset 23844852.  Of which there are 2676 bytes left in the file.  If I then choose to read all the bytes after offset 23844853 (just added 1) I get an error of end of file encountered.  I can't attach the file but it is only 27MB  and I'm unsure why I can't read data that should be there.  I've tried deleting the index file and this doesn't help.  Is there something obvious I'm missing?  Is my file somehow corrupt?  Thanks.

0 Kudos
Message 1 of 5
(3,501 Views)

Nothing immediately stands out to me as being incorrect here. Have you tried running this with another TDMS file of similar length? If you cannot upload the actual TDMS file, could you generate a dummy one so that we could recreate the error?

Applications Engineering
National Instruments
0 Kudos
Message 2 of 5
(3,455 Views)

Well using some code I was able to extract all of the segments and I do think that the last segment in my TDMS file is somehow corrupt.  If you read the Length property it returns 0, but as demonstrated there is plenty of data and reading it with a -1 on the length returns 23,847,528 values.  But even reading only the first segment the Length is 0 but the number of values read is 11,937,168.  I suspect this is somehow a corrupt TDMS file and I can live without the data, but would like to more gracefully handle corrupt files like this.

 

I tried writing one more time to the file in the hopes it would update the Length but it didn't.  I then thought I would update the length myself (writing the property).  After that I could read the length property back, but if I wrote to the channel the length wouldn't be updated again.  Defragging didn't help to.  I ended up with a file that wouldn't have it's Length value properly updated.

 

I likely cannot reproduce the issue since the file was generated on a Linux RT chassis, that likely suffered a power outage, which probably caused this.

0 Kudos
Message 3 of 5
(3,449 Views)

I had an issue a few months ago where I needed to try to recover data from a corrupted TDMS file that was created by Signal Express.  The PC that was logging the data would frequently lose power and I believe that is why this file was corrupted.

 

I came across this thread https://forums.ni.com/t5/LabVIEW/Corrupted-TDMS-File/td-p/2165954/page/3 that helped me recover some of the data from the file.

 

Perhaps there is some information in there that can help you.

0 Kudos
Message 4 of 5
(3,436 Views)

Try to connect string constants to group name and channel name inputs of second read (instead of output wires of first read). This is a shot in the dark, but TDMS Read returns eof error when group name is not connected and it reaches the last group in the file - so maybe something is mixed up here.

0 Kudos
Message 5 of 5
(3,418 Views)