.m files keep getting corrupted?

16 views (last 30 days)
Tony Wei
Tony Wei on 3 Nov 2023
Commented: Tony Wei on 3 Nov 2023
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 Comments
Tony Wei
Tony Wei on 3 Nov 2023
Okay, I will make a support ticket when I log onto the PC that created the corrupted files tomorrow.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 3 Nov 2023
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 Comment
Tony Wei
Tony Wei on 3 Nov 2023
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.

Sign in to comment.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!