12-27-2019 04:15 PM
Hi,
I was collecting data using DAQmx and saving in tdms file.
After a while, I noticed that PC does not work (freeze) and I shut down using a physical power button.
When I opened my tdms file with 'TDMS file Viewer' in labview, it can see all data. However, when I use 'TDMS open', -2503 error occurred.
Also, I am using TDMS Reader function library in Matlab and it also 'Lead in' occurred error. (I think the last part of my data is corrupted.)
I searched this problem in NI forum and found 'RecoveryTDMSFile.vi', which is doing something on last segment in TDMS file. However, when I run this vi, I see
Not enough memory to complete this operation.' pop-up message. (I checked my memory using Task Manager in Windows and I have plenty of memory (18.4/31.9GB))
My tdms file is 2.76 GB.
Please refer the below screenshots. My tdms file consists of around 5928 groups. I definitely can sacrifice my last group, which is 'G5928'. Is there anyway that I can use this data?
(If you compare G5927 and G5928 data, they are different. I guess G5928 is corrupted.)
Solved! Go to Solution.
12-27-2019 04:16 PM - edited 12-27-2019 04:18 PM
01-02-2020 09:21 AM
First I'd suggest backing up your partially corrupt file. I wouldn't want the data to be lost and then you to get mad at my suggestions which break it even more.
On a copy of your partially corrupt file, open it in a hex editor like HxD. Looking at the TDMS spec that you linked to it appears that every TDMS segment starts with "TDSm" so I'd go to the end of the file (CTRL+G, select end and hit OK). Then do a search (CTRL+F) looking for Text-string of TDSm with the direction being Backwards. This should find the last segment that was written. Use Select Block (CTRL+E) then change the Length to 9999999999999999, just to make sure it will select all the way to the end of the file. Click OK, then press the delete key. Then go to File >> Save to save the changes which should be the deletion of the last segment. This operation of selecting the last segment and deleting it should be possible with any hex editor, or LabVIEW VI if it is written right.
Now try to open the edited file and see if it works. If it does I highly suggest you perform a defrag on your file. I don't know what you are logging or how but I suspect the file is fragmented if you have that many groups and the file is that large. If it doesn't open correctly do the same process as before deleting the last segment and try again.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-02-2020 11:06 AM
Thank you!
I followed exactly your suggestion and it worked for me!
06-11-2021 10:20 AM
Kudos. I had the same problem and these exact instructions fixed the file for me. In my case, it was the last TWO segments in the file that needed to be deleted. Thanks!