01-22-2018 08:56 AM
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.
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-23-2018 03:33 PM
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?
01-23-2018 04:14 PM - edited 01-23-2018 04:16 PM
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-23-2018 07:50 PM
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.
01-24-2018 02:22 AM