Problem to open a matlab file, empty code.
46 ビュー (過去 30 日間)
古いコメントを表示
Hey guys,
I have a big question, moreover, a big problem and i hope that you save me.
I spent the last week working in a Matlab project and today, before to turn down my computer, i save the file.
Ok, a few hours later, when i open the Matlab, guess what? My code was clean, completely empty, without any character.
I try open the file in other computer and it was the same problem, the octave online and sublime text show a big amount of zeros.
I check the file and your length is around 3KB, what suggests that isn't empty.
I really don't know what to do, if you have any suggestion, please tell me.
Thanks
1 件のコメント
Walter Roberson
2019 年 10 月 26 日
編集済み: Walter Roberson
2019 年 10 月 26 日
I suspect you accidently used "save" naming your .m file . That would have saved the content of your workspace over top of the .m file, destroying the .m file.
If so, then the file is gone and probably cannot be recovered. You can look for a .asv (autosave) or .m~ (also autosave but for Mac or Linux) file, but if you do not have those then you will need to go into any system backups or source code control system you might have.
Always use regular backups, even as a student. You should run backups according to the maximum amount of work that you are willing to lose. For example if it would be okay to lose one day of work, then back up at least twice a day -- twice because one of the backups might not work for whatever reasons.
回答 (3 件)
CARLOS ALBERTO
2022 年 6 月 17 日
I have had the same problem, and I use the save option for a .mat file.
I don´t think I miss anything, since the file even opens the variables a created, but the codes are not shown in the main page. Only a blank sheet.
Right the opposite to Mathematica: it opens the codes, the programing, while the created variable you must re-run for activating them again. But that was easy. It just takes Ctrl+Shift over each steps of the codes.
2 件のコメント
Ibrahim A. Hameed
2022 年 10 月 29 日
I have the same problems where all my m.files from the last 10 years are not working at all. All are empty.
Walter Roberson
2022 年 10 月 29 日
I had a bunch of my MATLAB code content disappear over a year ago. For me the problem had to do with a corrupted filesystem on my MacOS system -- the fault was MacOS not MATLAB for me.
Mehran Ahmadlou
2023 年 1 月 28 日
I have the same issue with MATLAB 2022b! And I beleive it's nothing to do from our side, but it's a malab bug! All the mfiles out of sudden became blank, empty!
2 件のコメント
Frederike Petzschner
2024 年 8 月 16 日
Same issue I tried 3 versions of matlab and all m files appear empty. If I open the same m file on another computer the full content is still there. What is the bug and how can I solve it?
Wade
2023 年 3 月 30 日
Hi,
I have a similar problem. I saved file in MATLAB figure. After opening I got the graphs but no codes. Is it permanent code loss?
Regards,
Matti
1 件のコメント
Walter Roberson
2023 年 3 月 30 日
If you saved something on top of a .m or .mlx file, then it is a permanent loss unless you can find an auto-save as described in https://www.mathworks.com/matlabcentral/answers/487598-problem-to-open-a-matlab-file-empty-code#comment_760406 . You should be sure to configure system backups for any work like this.
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!