Problem to open a matlab file, empty code.
46 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Walter Roberson
am 26 Okt. 2019
Bearbeitet: Walter Roberson
am 26 Okt. 2019
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.
Antworten (3)
CARLOS ALBERTO
am 17 Jun. 2022
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 Kommentare
Ibrahim A. Hameed
am 29 Okt. 2022
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
am 29 Okt. 2022
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
am 28 Jan. 2023
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 Kommentare
Frederike Petzschner
am 16 Aug. 2024
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
am 30 Mär. 2023
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 Kommentar
Walter Roberson
am 30 Mär. 2023
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.
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!