I was working on analyzing a chunk of data and I accidentlally pressed ctrl-z multiple times inside the folder tree side window, I saw that most of my data was now gone. I managed to recover most of the data using a recovery software. However I am not able to load the .mat files. I have attached a single set of the .mat file. Thanks in advance for any help.
load matlab.mat
Error using load
Unable to read MAT-file /users/mss.system.BBorlN/matlab.mat. Not a binary MAT-file. Try load -ASCII to read as text.

댓글 수: 3

dpb
dpb 2023년 1월 12일
편집: dpb 2023년 1월 13일
Unfortunately, the likelihood is you'll not be able to recover those files once they've been corrupted.
If these files were obtained by the aforementioned recovery software, they may contain the data at the indicated-to-it locations on the disk the file(s) occupied, but that doesn't mean it reconstructed the file(s) identically.
A valid MATLAB Level 5 MAT-file begins with a 128-bye header, of which the first 116-bytes is human-readable text that contains the header information of how/when the file was created. (There's a link to the detailed specification @ <Documentation Link to .mat file format>
Looking at the content of your file, there's no recognizable text at the beginning of the file (nor, in fact, anywhere within it) so there's no chance any of the TMW mex routines are going to work; they'll all fail in it containing a valid haeader.
Whether there's any of the actual data there that could be read or not is uncertain but certainly it would take extensive forensic analysis and intimate knowledge of what the actual content of each was to have any hope at all and I'd venture that the probability of success would still be infinitesimaly small.
SANJAY JOSEPH CHACKO
SANJAY JOSEPH CHACKO 2023년 1월 14일
Thanks @dpb. This has been really helpful.
dpb
dpb 2023년 1월 14일
편집: dpb 2023년 1월 15일
Too bad don't have any better news...
I never use those features in the MATLAB UI so I don't really know what they do; looks like it probably actually wrote over the files from whatever was the preceding actions saved in the restore buffer...
Hopefully the scripts and raw data from which those .mat files were created are still around and you can reconstruct them.
To minimize such potential damage of inadvertent operator error, I have a routine that SAVEs the entire workspace with a current timestamp
% Backup current workspace to "WORKING ddMMMyyyy hhmm.mat"
fn="WORKING-"+string(datetime(now,'ConvertFrom','datenum','Format','ddMMMyyyy-HHmm'));
if exist('comment','var')
fn=fn+"-"+string(comment);
end
save(fn)
Then, at least the damage is limited to from the previous checkpoint and with command history recall, one can reconstruct a pretty complete history of actions since then (if don't neglect the use of the script).
This all works from the command line; what is saved to command history through the GUI UI route of operating MATLAB, I really can't say; just never have changed my working habits.

댓글을 달려면 로그인하십시오.

답변 (1개)

Animesh
Animesh 2023년 4월 3일

0 개 추천

Hi,
The file you provided is most probably corrupt. This is the reason why you are getting an error while loading the file.

카테고리

도움말 센터File Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기

제품

릴리스

R2022a

태그

질문:

2023년 1월 12일

답변:

2023년 4월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by