Can corrupted m-files be fixed?
古いコメントを表示
I have recovered some of my m-files after formatting my partitions.
But sadly, found them corrupted. Is there anyway to fix them?
Thanks.
Edited: The code becomes like the attached image.

10 件のコメント
Walter Roberson
2017 年 7 月 28 日
Not really enough information about the kind of corruption.
Ezz El-din Abdullah
2017 年 7 月 28 日
@Ezz El-din Abdullah: your screenshot clearly shows a .mat file (and certainly not an M-file as you wrote in your title and question), and it looks pretty normal for a compressed .mat file. How are you trying to open the .mat file? What error messages do you get?
John D'Errico
2017 年 7 月 28 日
The header does say .mat file there. And of course you cannot read a .mat file with a text editor.
Regardless, .mat file, or .m file, in either case, if you cannot read them using either load or edit, as appropriate for that file type,
The answer is you cannot really fix what may be missing, if some of the blocks from the file have been dropped out or corrupted. You have lost information. A .mat file is worse in that respect.
Ezz El-din Abdullah
2017 年 7 月 28 日
@Ezz El-din Abdullah: the answer to your question is to get the latest file version from your version control system, which is of course kept backed up externally to your working computer. Of course like all sensible programmers you use a version control system with backup.
Ezz El-din Abdullah
2017 年 7 月 28 日
Rik
2017 年 7 月 28 日
If you haven't followed Stephens advice, take mine: at the very least have your working folder in dropbox/google drive/skydrive/whathever.
For your current problem: you could try with Notepad++ to play around with what encoding this might be in, although I fear this file is a loss. It looks more like what I would expect from a .mat file than an .m file.
Walter Roberson
2017 年 7 月 28 日
Can you attach one of the m files for us to examine?
Ezz El-din Abdullah
2017 年 7 月 28 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Web Services についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!