Old .m files don't display code
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
This one is a real puzzle and has cost me 2 days of slog already.
I used an earlier version of Matlab for a project some 6-7 years ago and wrote a substantial amount of code. I organised the code into a main folder on my hard disk, containing about half of the code. The remaining .m scripts and .mat files I functionally organised into sub-folders. Over the years I've kept the code on several external hard drives and copied it from one to another, maybe two or three times altogether.
Now I've a project that requires me to re-use that old code. In the main folder all the .m files still show as having information inside (file size is several KB), but they don't display anything in Matlab, nor in a text editor, nor in WordPad. In contrast, all the .m files in the sub-folders work perfectly.
I've found a data recovery tool that shows there is still information inside the .m files in the main folder, but I can't extract it.
Any suggestion on how to tackle this and get the code out of the .m files is much appreciated!
3 comentarios
John D'Errico
el 3 de Jul. de 2014
Editada: John D'Errico
el 3 de Jul. de 2014
They are probably corrupted. You DO have a backup, right? Or has the backup also been corrupted? It happens to all of us.
Joseph Cheng
el 3 de Jul. de 2014
Editada: Joseph Cheng
el 3 de Jul. de 2014
When you look (open in text editor and matlab) is there anything in there? i know it doesn't display anything but there may be things in there. what i mean 14000 spaces can be 13Kb. special characters? it does sound like it is completely corrupted as nothing shows up.
Respuestas (4)
Jan
el 3 de Jul. de 2014
M-files are text files. If you cannot see the contents in the editor, the characters have been overwritten by spaces, zeros or other special characters. You can open the files in Matlab and check, which values are found inside, but without any doubt, the original contents of the files is lost. You cannot reconstruct them. So John's idea is the only way out: Recreate them from a backup.
0 comentarios
CARLOS ALBERTO
el 17 de Jun. de 2022
Jan,
Recreate them from a back up? Back up we do not re-create, we open. And this for amost everything I know in computation, including the Mathematica files I worked with, and other statistics software I used.
Definetely, not expected. We work we programed codes, advancing over it day by day. If, instead, when we go to our yesterday file and find out none of the programed codes. Then, we are working with something that is for a day only, or else for a task without closing the computer or files daily.
0 comentarios
RECAI YILMAZ
el 10 de Nov. de 2023
I had the same issue on Matlab 2023b. The issue is resolved when I copied the files (literally ctrl c and ctrl v at the same directory). To copy them, it needed admin priviledges. Maybe what is blocking Matlab to display them was not having the admin permission.
0 comentarios
Ver también
Categorías
Más información sobre File Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!