How to read a corrupt mat file in reverse?

4 views (last 30 days)
Florian
Florian on 11 May 2020
Commented: dpb on 11 May 2020
For the first time in 15 years of using matlab I ran into the issue today of not being able to open a mat file.
Following the solutions proposed in this answer (https://www.mathworks.com/matlabcentral/answers/98890-how-do-i-recover-data-from-a-corrupt-mat-file) I was able to recover the first seven variables from the mat file using splitmat.m, but I'm unable to load the 50+ others which took me over a day to create.
I'm able to read the same content (first 7 variables) from the corrupt file using...
whos -file corruptMATFileName
...but I get an error when trying to load any variable (whether recognized with the command aboe or not) using the specific variable name:
load('<corrupted_file>.mat', '<uncorrupted_variable>');
Therefore my questions: is it possible to load a mat file in reverse (reading the bottom variables first) or any other way in order to skip the faulty part of the mat file?
Kind regards,
Florian
  3 Comments
Florian
Florian on 11 May 2020
Unfortunately the link does not provide any solution to my problem.
dpb
dpb on 11 May 2020
Directly, no. I don't think there is any canned solution you'll find, though. The link shows using low-level access to the content...
Of course, you can also just retrieve bytes directly from the .mat file and reconstruct if you can find the location of the data. If it is compressed, then that's not directly helpful, either, unfortunately.
I suspect you'll be forced to recreate the data, unfortunately, or the solution otherwise may take as long to research/develop code to extract the data as going on would -- without, the knowledge of what level of success might have.

Sign in to comment.

Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!