Does this mean the file is corrupted?

4 次查看(过去 30 天)
MLP
MLP 2021-4-30
评论: MLP 2021-4-30
Just came back to work on my code and found that several functions files open to these type of characters... is there a way to recover the actual code or are they completely lost? Why does this happen? If the files are lost I wouldn't like to lose a week's worth of work again.
  2 个评论
Rik
Rik 2021-4-30
The only alternative I can think of is that your file was encoded with ANSI, but now the editor thinks it is UTF-8. You can try opening these files in Notepad++ and see if messing with the encoding gets you closer to your original file.
And how to prevent this? Regular backups. There is a common wisdom that anything without a backup is not important. The absolute best practice is to have backups to 2 different off-site places (e.g. cloud storage), preferably on different continents and in different formats.
As to why this might have happened: it is impossible to tell from your description. We don't know your OS, your hardware, or even your Matlab version (other than that it is at least R2006a, since you can't change the editor colors in the way you did prior to that). Even if you did provide that information I couldn't tell you, because it isn't my area of expertise.
Walter Roberson
Walter Roberson 2021-4-30
utf8 vs ascii would not explain the above. All us-ascii characters up to ~ (127) have exactly the same representation in utf8.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2021-4-30
Unfortunately your file is very likely gone. Check for asv files but don't be surprised if none are there.
I do not see any Magic Numbers that hint what the file might be now.
Does the character string NSpïžzè mean anything to you?
  1 个评论
MLP
MLP 2021-4-30
Does not dound familiar. I have never had this happened to me before, the only difference is that I am working from a folder located on an external hard drive where I got software installed that I use when working on different computers, so there is some plug/unplug going on. Although this matlab function was the only one affected, the main program and other functions are OK.

请先登录,再进行评论。

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by