.m files keep getting corrupted?

15 次查看(过去 30 天)
Tony Wei
Tony Wei 2023-11-3
评论: Tony Wei 2023-11-3
I'm on 2022a, and recently have had multiple .m files change from UTF-8 encoding to windows-1252 encoding or something else. The code turns into mostly gibberish or get replaced by blank spaces. I have been working on two computers, saving onto the same external drive. Luckily, I have the original code backed up. But, why is this happening and can I restore the original files somehow? Even a .mat file seemed to have been affected, where Matlab refuses to load the contents. Thanks.
  2 个评论
Tony Wei
Tony Wei 2023-11-3
Okay, I will make a support ticket when I log onto the PC that created the corrupted files tomorrow.

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2023-11-3
Chances are one of your scripts or functions is overwriting them without you being aware of it. Can you do anything to reproduce it? Like does it always corrupt some files after you run some program? Or is it completely random?
  1 个评论
Tony Wei
Tony Wei 2023-11-3
I believe the possible culprit is that the other laptop I have been using sometimes overheats, and when it does, Matlab tries to do something to save my .m files but doesn't actually make a .asv file? Usually I just reboot the computer from its hibernation and all my Matlab files are still there and I just resume my work. And it's never the file I'm actively working on that corrupts, but one of the others I have open.
I also just noticed that when I tried to push my most recent changes to Github through Github Desktop, I'm receiving these errors...
error: inflate: data stream error (invalid stored block lengths)
error: corrupt loose object '2a8d5a0efc1d84d40c1253920eeff8f608d9de93'
fatal: unable to read 2a8d5a0efc1d84d40c1253920eeff8f608d9de93
This is probably not the right place to ask about how to circumvent those errors, but if you have an idea how to fix this issue or can suggest where I should ask this question, please let me know.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by