Problem to open a matlab file, empty code.
46 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lucca Siebra de Pontes
el 26 de Oct. de 2019
Comentada: Frederike Petzschner
el 16 de Ag. de 2024
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 comentario
Walter Roberson
el 26 de Oct. de 2019
Editada: Walter Roberson
el 26 de Oct. de 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.
Respuestas (3)
CARLOS ALBERTO
el 17 de Jun. de 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 comentarios
Ibrahim A. Hameed
el 29 de Oct. de 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
el 29 de Oct. de 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
el 28 de En. de 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 comentarios
Frederike Petzschner
el 16 de Ag. de 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
el 30 de Mzo. de 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 comentario
Walter Roberson
el 30 de Mzo. de 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.
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!